Coloring input type=file browse button; uploading mutiple files

Coloring input type=file browse button; uploading mutiple files

Post by Ron Brenna » Wed, 12 May 2004 06:33:36

Good afternoon.

The entire task that I'm trying to achieve is to allow a user to browse and
upload multiple files simultaneously, hiding the Browse button of <input>
tags of type="file" and replacing it with a button of my own background
color and text.

The file paths I'd like displayed in a textarea and then the files uploaded
at once.

The code chunks toward my goal I got from the Web (below) I think worked
before IE 5.0 but for me produces an "Access Denied" error.

Can anybody help with any part of my problem (coloring the browse button,
listing multiple chosen files in a textarea, uploading an artibrary number
of files at once)?

Thanks, Ron.



------- JavaScript -------------
function addFile(path) {
document.getElementById(\"picturesTextArea\").value = path;
document.getElementById(\"text\").focus();
return true;
}

------ HTML ------------
<td>
<input
type="file"
id="pictureFile"
name="pictureFile"
style="display:none;"
onpropertychange="if(event.propertyName=='value')
{addFile(this.value);}">
</input>");
<textarea
id="picturesTextArea"
name="picturesTextArea"
cols="75"
rows="3"
maxlength="200">
</textarea>
</td>");
<td>
<button type=\"button\"
"onClick=\"this.form.pictureFile.click();\">
AddPicture
</button>
</td>");

 
 
 

Coloring input type=file browse button; uploading mutiple files

Post by nospam_goo » Thu, 13 May 2004 23:41:00

There are serious restrictions on file input boxes. I don't think
you're allowed to make them invisible, write to the box from
javascript, or maybe even read from it anymore. The reason is then I
can "choose" a file on your system and upload it without you knowing
it. It's a slippery slope. You're probably better off either sticking
with what's "normal" or writing an ActiveX/Applet/Flash/etc code to do
what you need.


Mike

 
 
 

Coloring input type=file browse button; uploading mutiple files

Post by Ron Brenna » Fri, 14 May 2004 10:10:04


Mike,

After a lot of work over the last few days this is what I believe to be
true:
1) I must click on the original browse button
2) I can read the selected path from the field, at least up to IE 5.0. Maybe
one can't with version 6.

Thanks,
Ron.