By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,728 Members | 2,462 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,728 IT Pros & Developers. It's quick & easy.

Q: Html/JS form input element file upload?

P: n/a
(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>
Mar 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Rob Mitchell wrote:
(Sorry if this appears twice)


See news:19****************@PointedEars.de
Score adjusted

PointedEars
Mar 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.