Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
140
rated 0 times [  147] [ 7]  / answers: 1 / hits: 30462  / 13 Years ago, mon, january 23, 2012, 12:00:00

Instead of using an input type=file html tag, is it possible to bring up a choose a file to upload dialog box by clicking a input type=button? Then when a file is selected from the choose a file to upload dialog box, the file path gets inserted into a regular html input type=text tag?



I've seem that gmail does something similar but not with buttons and text inputs, they simply have a link add file or something like that. When that link is clicked, it shows the select file(s) to upload by mail.google.com dialog box. When a file is clicked, the file name is shown on the screen.



How are they doing that?


More From » jquery

 Answers
3

I think most browsers have this locked down for security purposes. Buttons and text boxes can be manipulated via JavaScript. File input boxes cannot, and for good reason; imagine if a javascript could open a dialog, set the path to a sensitive file on your system, then simulate the button click to download the file!






By the way, if you are looking to style it, perhaps this would work: http://www.quirksmode.org/dom/inputfile.html


[#87847] Saturday, January 21, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dorothylorrainef

Total Points: 456
Total Questions: 102
Total Answers: 115

Location: El Salvador
Member since Sun, Sep 12, 2021
3 Years ago
;