File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Hidden input type= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Hidden input type="file" technique" Watch "Hidden input type="file" technique" New topic

Hidden input type="file" technique

dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
I noticed that many apps use hidden file upload field, so curiouis about implementation technique
1. Is input type=file placed in div with no visibility?
2. Is an event onclick sent to open file choose dialog?
3. Is onchange handler used for submission a form when user selected a file?
Can somebody provide a JS code example?
Another question related how to upload links. In classic input type=file I can type path or even URL/link (noticed that IE doesn't allow URL for security reason, however FF does). How to manage that in both browsers friendle manner, when a user can directly provide a link?

Tough in space?, <a href="" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="" target="_blank" rel="nofollow">Check it here.</a><br /><a href="" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Are you quite sure about this? I've never seen (or read about) hidden file upload fields, and Google seems to know nothing about them. Could you provide an example?
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Actually I'm looking for an example to save some time on implementation. Such fields used in Microsoft's live mail or gmail. Since both products prohibit reverse engineering, I can't pull an implementation from them. Of course I'll share my implementation with all of you without problems.
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
If you looking for IE only solution, then you can do something similar to

also, take alook at
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
I used hidden div, but your solution looks more appealing.
I agree. Here's the link:
subject: Hidden input type="file" technique
It's not a secret anymore!