drcb
July 3rd, 2002, 08:32 AM
I'm trying to workaround style problem with "Browse" button in the <INPUT TYPE=FILE> (as far as I know - it is impossible to alter color, font and other style stuff of this button). So I invented to hide this fileupload control and make wrapper input control, which only calls methods from hidden fileupload.
Code is following:
<html>
<body>
<h>This is a test</h><br>
<form id="frm" method="POST" enctype="multipart/form-data">
This should be <input type="button" onclick="document.all.f.style.visibility='hidden';" value="Hidden"><br>
<input type=file name="f" style="visibility: visible;"><br>
This is for user:<br>
<input type="text" name="t" readonly=true style="border-color: green; font-color: red;">
<input type="button" name="b" value="BrowZe.." onclick="document.all.f.click(); document.all.t.value=document.all.f.value;" style="border-color: green;">
<br>
<a href="javascript:document.all.frm.submit();">Submit</a>
</form>
</body>
</html>
Now if I click native "Browse" button, select a file and then click "Submit" - all works as expected.
But if I click wrapper "Browse" button, select a file and then click "Submit" - I get "Access denied" exception.
Note: I'm not trying to write any data into file upload control, I'm only reading and calling its .click() method. And it works (shows file selection dialog, and correctly fills filename). But after this action browser goes into strange mode, when calling .submit() causes "Access denied" exception.
Is it MSIE's bug?
Is there workaround for this?
Code is following:
<html>
<body>
<h>This is a test</h><br>
<form id="frm" method="POST" enctype="multipart/form-data">
This should be <input type="button" onclick="document.all.f.style.visibility='hidden';" value="Hidden"><br>
<input type=file name="f" style="visibility: visible;"><br>
This is for user:<br>
<input type="text" name="t" readonly=true style="border-color: green; font-color: red;">
<input type="button" name="b" value="BrowZe.." onclick="document.all.f.click(); document.all.t.value=document.all.f.value;" style="border-color: green;">
<br>
<a href="javascript:document.all.frm.submit();">Submit</a>
</form>
</body>
</html>
Now if I click native "Browse" button, select a file and then click "Submit" - all works as expected.
But if I click wrapper "Browse" button, select a file and then click "Submit" - I get "Access denied" exception.
Note: I'm not trying to write any data into file upload control, I'm only reading and calling its .click() method. And it works (shows file selection dialog, and correctly fills filename). But after this action browser goes into strange mode, when calling .submit() causes "Access denied" exception.
Is it MSIE's bug?
Is there workaround for this?