Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Q: Html/JS form input element file upload?

Reply
Thread Tools

Q: Html/JS form input element file upload?

 
 
Rob Mitchell
Guest
Posts: n/a
 
      03-17-2006
(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>


 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      03-18-2006
Rob Mitchell wrote:

> (Sorry if this appears twice)


See news:


Score adjusted

PointedEars
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move value from one form element to another, hidden element viaJavaScript OccasionalFlyer Javascript 6 07-29-2009 03:33 AM
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
what's the difference between a normal form element and a web control element? Masudur ASP .Net 12 03-26-2007 05:33 AM
moving from form element to form element Rod Snyder ASP .Net 1 05-29-2004 01:55 PM
get the form element from a frame element Mr. x HTML 3 12-11-2003 08:44 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57