Hi friends,
I would appreciate your help here. Thanks, Jopseph.
I m submitting a form that contains an
<span id=gAttachBI><input type=file name="attach"></span> field. since i have to stay in the same page (page A == an html page) that submits the form, i submit it to a page (page B == a
servlet page) that lives in an iframe in page A.
now since i want to let the user upload a file over and over, while i finish processing the sent data on page B, I do:
out.print("<script>window.parent.wm_handleAttach('" + attached_file_name + "');</script>");
now on page a there is a javascript function called wm_handleAttach(filename) that does:
document.all("gAttachBI").innerHTML='<input type=file name="attach">'; Why do I do that? because i stay in the same page after submitting, and i want to clean the file field after i submit!!!
you know i cannot set the value attribute of an
<input type=file> thru javascript, since this violates the security of the browser.
so my way to "clean" the field is to re-create it.
this works fine, both in IE and Firefox.
Problem is when I submit the uploaded file thru the dynamically created input field (e.g. in the second time i submit a file), it works fine in IE, but not in FF...
in FF every thing seems to work fine: the browse window opens and it takes it a while to send a large file, but my codein the servlet (page B) does not read it fine.
I am using Jakarta commons upload jar to readthe uploaded file... I have discovered that when I send it thru FF, the condition:
is not true, so it does not continue into the "if" to process the file data. but the same servlet process correctly the file sent from IE.
the problem seems to be that a dynamically created <input type=file> in FF sends other things than a static <input type=file> in FF.
everythings works fine in FF if i do not re-create the <input type=file> after each time I submit. (i.e. i give up trying to clean the <input type=file> field after each time i submit)
Please help if you have any idea......
[ May 09, 2005: Message edited by: Joseph Sweet ]
[ May 09, 2005: Message edited by: Joseph Sweet ]