Clear All Button For Cmultifileupload

When I have follwing CMultiFileUpload, how can i clear all the pics with a button.


<div class="row">

        <?php echo  CHtml::activeLabelEx($model,'image'); ?>

        

        <?php $filetype='jpg|jpeg|png|gif';

				$this->widget('CMultiFileUpload', 

				array('model'=>$model,

				'name' => 'image',

				'max'=>5,

				'accept'=>$filetype,

				'duplicate'=>'Duplicate file!',

				'denied' => 'Invalid file type' )

				); ?>

        <?php echo CHtml::error($model,'image'); ?>

	</div>

A javascript and access via ID, but after some research I didn’t find something if there is a clear or anything else.

http://aspnetupload.com/Clear-HTML-File-Input.aspx

Thanks, that gives me the idea now, as I thought it must be more specific for the widget.

But I want to use jquery.

So I gave the widget the Id imagedata and did this:


$("#imagedata").replaceWith($("#imagedata").clone(true));

But it is not working correct.

It removes the Button for file search.

Do I need an Input field instead?

Try with a class instead of an ID. Maybe having two elements with the same ID is confusing the browser.

Hey, I added this:


'htmlOptions'=>array('class'=>'mf'),

and changed the jquery


$("#mf").replaceWith($("#mf").clone(true));

But it doesn’t work.

Should I access it via an ID from the Html output?


<div id="imagedata_wrap" class="MultiFile-wrap">

<input id="imagedata" class="mf MultiFile-applied" type="file" name="image[]" value="" style="position: absolute; top: -3000px;">

<input id="imagedata_F1" class="mf MultiFile-applied MultiFile" type="file" name="image[]" value="" style="position: absolute; top: -3000px;">

<input id="imagedata_F2" class="mf MultiFile-applied MultiFile" type="file" name="image[]" value="">

<div id="imagedata_wrap_list" class="MultiFile-list">

<div class="MultiFile-label">

<a class="MultiFile-remove" href="#imagedata_wrap">x</a>

<span class="MultiFile-title" title="File selected: 1vkgmecqjpvc.png">1vkgmecqjpvc.png</span>

</div>

<div class="MultiFile-label">

</div>

</div>