Q: Html/JS form input element file upload?

Discussion in 'Javascript' started by Rob Mitchell, Mar 17, 2006.

  1. Rob Mitchell

    Rob Mitchell Guest

    (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>
     
    Rob Mitchell, Mar 17, 2006
    #1
    1. Advertising

  2. Rob Mitchell wrote:

    > (Sorry if this appears twice)


    See news:


    Score adjusted

    PointedEars
     
    Thomas 'PointedEars' Lahn, Mar 18, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rod  Snyder

    moving from form element to form element

    Rod Snyder, May 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    419
    Vidar Petursson
    May 29, 2004
  2. Matt
    Replies:
    8
    Views:
    144,658
    zeeshanakhter2009
    May 26, 2012
  3. Matt
    Replies:
    1
    Views:
    11,300
    David Dorward
    Oct 12, 2004
  4. Replies:
    1
    Views:
    973
    Gabriel Genellina
    Nov 25, 2006
  5. Prakash
    Replies:
    3
    Views:
    495
    Ray at
    Nov 12, 2003
Loading...

Share This Page