473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Coloring input type=file browse button; uploading mutiple files

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\").valu e = 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>");

Jul 17 '05 #1
2 9899
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
"Ron Brennan" <rb******@magma.ca> wrote in message news:<9d********************@magma.ca>...
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\").valu e = 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>");

Jul 17 '05 #2
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,

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.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ron Brennan | last post by:
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...
1
by: Ersin Gençtürk | last post by:
hi , I need to customize <input type=file , tag. I find a way to do that : on the client side by javascript and css first , I am hiding the fileupload object , then I am calling the click...
2
by: Ersin Gençtürk | last post by:
hi , I need to customize <input type=file , tag. I find a way to do that : on the client side by javascript and css first , I am hiding the fileupload object , then I am calling the click...
3
by: Maris Janis Vasilevskis | last post by:
Hi, I create a binary file on client side using ActiveX. Now, I need to upload it. First idea - hidden Input type=file Does not work, because value is read only. A quickly made working...
3
by: oopaevah | last post by:
I want to have a separate button which invokes the "browse" button on an input type=file. In internet explorer the following code works ok, in firefox nothing happens. All I do is call click()...
5
by: hrpreet | last post by:
Hi All, I need the file chooser in the jsp, just for brosing and saving the file path in the database, so i have used the following code.I dont need to read the file content. I have to make it...
9
by: Prakash Singh Bhakuni | last post by:
am replacing the default "Browse..." button for input type=file. This works fine except that the form will only submit after the SUBMIT button is clicked twice. Any ideas on why this is happening...
6
by: reiyel | last post by:
hiya all i would like to ask some help for a little javascript, here's my problem: i have a html page with a <input type="file"> box, problem is i don't want the user to be able to write on the...
5
by: magix | last post by:
Hi, with: <Input type="file"...> it will let the user to click to "browse" button to browse for files, question is how can I limit the file type to be only jpg and gif extension, when the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.