Forum Moderators: open

Message Too Old, No Replies

Replacing button in file-tag

         

empa

7:33 am on Jan 13, 2004 (gmt 0)



I am trying to replace the button in the <input type="file"...> tag. With javascript it is possible to hide the tag and have another button calling it like the example below, but when the form is submitted the file field will first be emptied and the file not sent.

Any ideas? Is this not possible because of security issues?

Regards,
Emil

<input id="realfile" type="file" style="visibility:hidden;" onchange="document.getElementById('dummyfile').value=this.value" />

<input id="dummyfile" type="text" /><br/>

<input type="image" src="img/button.gif" onclick="document.getElementById('realfile').click();return false;">

DrDoc

3:29 pm on Jan 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World! :)

It is not possible to do what you want to do, partially because of security issues, but also because the button is never part of your Web page. It is rendered by the OS. Hence, the look and feel of your button depends 100% on the OS the browser is running on.