<html>
<head>
</head>
<body>
<form id="form1" enctype="multipart/form-da
<input id="File1" type="file" onchange="document.getElem
<input id="Text1" type="text" />
</form>
</body>
</html>
Main Topics
Browse All TopicsI have an html form with a file upload field - <input id="File1" type="file"....
and a text field - <input id="Text1" type="text".....
When a user browses for a file to upload I need to have the value be copied into the text field.
Is there a way I can do this with an onchange event using javascript or vb script?
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
If I recall correctly this can't be done (I tried it years ago for a client).
This is intentional as it prevents (in theory) a potential security risk on the client machine. (Consider them selecting an image to upload and you then change the path to upload some other important file).
I believe I tried various methods but didn't find a way around this.
I'm not even sure if you can read the value of the file element in the processing page. If you don't need to display the path in a text element on your form page (ie you just want to store the original path) then you may be able to get it on your processing page. I usually use ASPUpload (from Persits) to handle file uploads - this uses a com object to create an upload object that may be able to read the original path that you can access and save.
Good luck
If all you want to do is something like what Pratima_mcs' code does then that will work (at least in some browsers). It looks like at least in some cases the browser will let script READ the value to write or use it somewhere else. I know this doesn't work the other way though (i.e. writing a value to the file input).
bol
Business Accounts
Answer for Membership
by: b0lsc0ttPosted on 2008-04-10 at 20:13:00ID: 21331174
kevinvw1,
No. The server (that does the uploading) could send it back to the page but the browser prevents Javascript from reading or writing to file input tags.
Let me know if you have any questions or need more information.
b0lsc0tt