0

How are you supposed to prevent the CMultiFileUpload widget from appending the file names of selected files to the page?

Here is my code:

<?php
$this->widget('CMultiFileUpload', array(
    'name' => 'images',
    'accept' => 'jpeg|jpg|gif|png',
    'denied' => 'Invalid file type',
    'htmlOptions' => array('multiple'=>'multiple'),
));?>

Here is a picture of what I am talking about:

picture

I need to remove what the arrows point to. It's also strange why it says "No files selected" when that isn't the case. If I submit the form, the file does indeed get sent to the server.

Edit: It does what I want if javascript is turned off though. It also fixes the "no files selected" error. Is there a way to disable the javascript for just the widget?

Community
  • 1
  • 1
train
  • 610
  • 2
  • 11
  • 20

1 Answers1

1

if you want to hide the names of the files you have uploaded then you can use the options in your CMultiFIleUpload eg:-

<?php
$this->widget('CMultiFileUpload', array(
    'name' => 'images',
    'accept' => 'jpeg|jpg|gif|png',
    'denied' => 'Invalid file type',
    'htmlOptions' => array('multiple'=>'multiple'),
    'options'=>array(
     'onFileAppend'=>'
                    function(e,v,m)
                     {
                       // try using e.preventDefault();
                    (".MultiFile-label").css("display","none");
                    }
                    '
)
));?>

Note:- I haven't tested it but hope it helps.

Let me see
  • 5,063
  • 9
  • 34
  • 47