Q: Html/JS form input element file upload?

R

Rob Mitchell

(Sorry if this appears twice)

Hi,

I know this has probably been beaten to death but
I was working with Class by Stickman --
http://www.the-stickman.com which uses DOM to
create multiple file input elements in a form.

I'm trying to just hide all the form input elements
of type file and providing a link to call each one's
click() method. This works fine except when submitting
the actual form. IE 6 complains with "Access is denied"

Try copy/pasting the HTML below (don't forget the
attachment) and if you click the regular "Browse..."
button and submit then it works.

If you click the "My Browse..." link, select one file,
and try to submit, get "Access is denied"

Windows XP Pro SP2 with IE 6




<html>
<head>

<script src="multifile_compressed.js"></script>

<script language="Javascript">
function myBrowse() { document.form1.file_1.click(); }
</script>

</head>
<body>

<a href="javascript:document.form1.submit()">Submit Me</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="javascript:myBrowse()">My Browse</a>
<br><br>

<form name="form1"
enctype="multipart/form-data"
action="javascript:alert('it works!!')"
method="post">

<input id="my_file_element" type="file" name="file_1" > <!-- The
file element -- NOTE: it has an ID -->

<input type="submit">
</form>


Files:
<!-- This is where the output will appear -->
<div id="files_list"></div>
<script>
<!-- Create an instance of the multiSelector class, pass it the
output target and the max number of files -->
var multi_selector = new MultiSelector( document.getElementById(
'files_list' ), 5 );
<!-- Pass in the file element -->
multi_selector.addElement( document.getElementById(
'my_file_element' ) );
</script>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top