Il Neofita wrote: > <script type="text/javascript" language="JavaScript"> > function invia() > { > var url = '/test/'; > var params = 'file=' + $F('fi'); > alert(params); > > return false; > } > </script> > </head> > <body> > <form onsubmit="invia();" method=post> > <input type="file" id="fi" /> > <input type=submit> > </form> > </body> > </html> > > Everytime I receive file=undefine. I would like to have the name of the file
You can't. It's a JS security issue. Browsers do not let you have access to the contents or name of the file chosen via a file input. The best you can do is wait for the user to submit it to the server(Prototype can't serialize a file input either) and then make an Ajax request to get it back. -- Michael Peters Developer Plus Three, LP _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs