Click to See Complete Forum and Search --> : HTML Form-based File Upload problem.


asid_onhopo
August 27th, 2002, 09:07 AM
hello,
i'm stuck with a problem related to HTML form-based file upload. The FORM looks like:

<FORM method="POST" action="/cgi-bin/upload.pl" enctype="multipart/form-data">
<input type="file" size="60" name="upfile">
<input type="submit" value="Upload">
</FORM>

The problem is that i want to display a message on the SAME browser window, REPLACING the browser window contents.... telling the user that File Upload has started as soon as a user clicks on the "Upload" Submit button.

Every time i try a document.write("<my Message>"); using the onClick() or the onSubmit() methods of JavaScript, file upload fails :confused: Also, if i have a "print" statement embedded within the "upload.pl" perl script to be returned to the browser before i capture the HTTP packets and write my data to disk, it is displayed only AFTER the upload has finished and not as soon as the user has clicked on the Upload button....

Anybody with any suggestion, comments ???

TIA,
Asid.

websmith99
September 23rd, 2002, 05:22 PM
Why don't you have your onSubmit event launch a JavaScript popup window that has the message:

"File upload has started. This may take a while."

The page generated by upload.pl can then close the popup window after upload is complete.

asid_onhopo
September 23rd, 2002, 10:49 PM
thanks for replying, but i solved my problem using dynamic layers. I created 3 layers - one for the input type "FILE", one for the Upload Button and one for the message that i wanted displayed.

I hid the message layer initially, and when the user clicked on the Upload Button, it would execute a JavaScript function which would hide the FILE input and the Upload Button and make visible the message that Upload was under progress... Then the JavaScript function as the last statement would submit the form so that upload would start.

Thanks anyway, :cool:
Asid.