[Javascript] Programmatically invoke the file browse dialog of input type=file

Flávio Gomes flavio at economisa.com.br
Fri Sep 29 16:33:45 CDT 2006


I don't believe it's possible or easy to do.

If you check GMail on Firefox you'll see they use the standard "input file".

Gaz Newt escreveu:

> 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() for the input control.
>
> Do you know how to make this work in firefox?
>
> Thanks
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>
> <head>
>     <title>Test</title>
>     <meta http-equiv="Content-Type" content="text/html; " />
>     <script type="text/javascript">
>     function test()
>     {
>         var oTest = document.getElementById( "mytest");
>         oTest.click();
>     }
>     </script>
> </head>
>
> <body>
>
> <form id="myform" action="test.aspx" method="post">
>     <input type="file" id="mytest" value="monkey" />
>     <br />
>     <input type="button" value="Programmatically Invoke The File 
> Browser Dialog" onclick="javascript:test();" />
> </form>
> </body>
>
> </html>
>
> ------------------------------------------------------------------------
> The all-new Yahoo! Mail 
> <http://us.rd.yahoo.com/mail/uk/taglines/default/nowyoucan/free_from_isp/*http://us.rd.yahoo.com/evt=40565/*http://uk.docs.yahoo.com/nowyoucan.html> 
> goes wherever you go - free your email address from your Internet 
> provider.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>

-- 
Flavio Gomes
flavio at economisa.com.br




More information about the Javascript mailing list