Many web developers came to the problem that they are not able to change value of file input field from Java Script in the web application. There is no access to value field of file input tag because of security restriction. However there is a trick how to erase this field if you need it in your application. 
   
You can simply redraw the html block where your input tag is located. In this case all data will remain the same except the selected file value.
<script language=”javascript” src=”jquery-1.3.2.min.js” type=”text/javascript”>
 </script>
<script language=”javascript”>
 function example_reset_html(id) {
 $(’#'+id).html($(’#'+id).html());
 }
 </script>
 <form>
 <div style=”float: left;” id=”example_file”><input type=”file” /></div>
 <input type=”button” value=”Clear” onclick=”example_reset_html(’example_file’);”  />
 </form>
--------------------------------------------------
<div id="uploadFile_div"> <input type="file" class="fieldMoz" id="uploadFile"              onkeydown="return false;" size="40" name="uploadFile"/> </div> <a onclick="clearFileInputField('uploadFile_div')"                           href="javascript:noAction();">Clear</a> 
<script> function clearFileInputField(tagId) {     document.getElementById(tagId).innerHTML =                      document.getElementById(tagId).innerHTML; } </script> 
                    
                
                
            
        
浙公网安备 33010602011771号