09-25-2003, 01:50 AM
I have posted a similar question before, but I just like to ask your suggestion on what to do.
I want to upload some files to the server, but because user often typed in an incorrect path for the file, we are going to stop them doing that by mocking up an "input field + button".
(see attached file)
What I want to perform is to:
- click the 2nd Browse Button and select the file.
- the path appears on the input box.
- upload the File.
but when I clicked upload, the path disappeared!!! can anyone please help me!
09-25-2003, 02:36 AM
Even if you'd be successful with it, you should always check on the server if the attached file exists. So why bother with it?
09-25-2003, 02:59 AM
or to be simple, if the path is correct in the "input box", and the CGI program is called, will I still be able to upload the file even if I don't use the <input type=file"> ?
09-25-2003, 03:03 AM
I think the file field is required for upload to be successful
09-25-2003, 04:33 AM
Two many form tags!
The problem with that script is that it's not designed for what you want to do, just to provide a 'dummy' file upload button that can be labeled and styled. Try this:
<form name="LANSA" onsubmit="FileToBeSent.disabled=true">
<div style="position:relative;height:30px;margin:0px 4px;">
<input id="dummyfile" type="text" name="FileToBeSent" readonly="readonly"
style="position:absolute;top:2px;left:0px;width:148px;font:11px 'comic sans ms';color:darkred;" />
<input id="realfile" type="file" name="Filename"
style="position:absolute;top:0px;left:8px;clip:rect(auto auto auto 142px);"
<input type="submit" value="Upload" />
IE doesn't do onclick for file inputs, and moz ignores onchange so, both are covered. Disabled the 'dummy' textfield onsubmit to keep it from cluttering up the data. If this doesn't work in Opera, keep it to yourself. :p hth
<edit type="angry">Please remove LINEFEEDS where this editor has broken the code (width:148px;fon<-----).</edit>
09-25-2003, 06:51 AM
I think putting a text field with readonly attribute on top of the file field is the only way to go too... really can't think of other way...