killboy Posted December 23, 2008 Share Posted December 23, 2008 Hi there.I'm working with and input type "file". After making all the operations uploading with the server script language, I need the input value to reset. This is the input: <input name="file_upload" id="file_upload" type="file" class="label" size="60"> When I finish with the upload, via JavaScript I say document.getElementById("file_upload").value=""; I works fine on Firefox, but IE doesn't want to do it. Anyone could tell me how to do this on IE?Thanks. Link to comment Share on other sites More sharing options...
rnd me Posted December 24, 2008 Share Posted December 24, 2008 does null work better than "" ? Link to comment Share on other sites More sharing options...
Synook Posted December 24, 2008 Share Posted December 24, 2008 JavaScript isn't actually supposed to be able to modify the value attributes of inputs of type file for security reasons (e.g. file_input.value = "C:\sensitive.doc"; form.submit() ). However, you could replace the input with completely new HTML, e.g. <div id="file_con"><input name="file_upload" id="file_upload" type="file" class="label" size="60"></div> document.getElementById("file_con").innerHTML = "<input name=\"file_upload\" id=\"file_upload\" type=\"file\" class=\"label\" size=\"60\">"; Link to comment Share on other sites More sharing options...
killboy Posted December 24, 2008 Author Share Posted December 24, 2008 That worked perfectly.Thanks Synook. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.