Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use Javascript to list local dir contents

    Well here is my problem in general
    I would like to allow a user to select multiple files and upload them at one time. It looks like the built in file upload for html will only allow 1 file to be selected at a time.

    To get around this, I thought that if I had a user select 1 file, then use a little JS to take the file path to list the directory contents to a checked list box or something. Here the user could select the filenames and then upload them all at one time.

    My problem is that I am unable to figure out how to access / list the contents of a local directory for a user. (or my problem is I am taking the wrong approach here)

    If anyone knows how to go about this / has a better idea / knows how to allow multi selections when uploading files / know of some good sites or references please let me know. My luck with google seems to be running out

    Thanks!

    Bob

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Canada, eh?
    Posts
    133
    Thanks
    2
    Thanked 3 Times in 3 Posts
    #1 - you can't use JS to access the user's local harddrive.

    #2 -
    Code:
    <form enctype="multipart/form-data" action="..." method="post">
    Upload Files<br><br>
    1. <input name="file1" type="file"><br>
    2. <input name="file2" type="file"><br>
    3. <input name="file3" type="file"><br>
    4. <input name="file4" type="file"><br>
    5. <input name="file5" type="file"><br>
    6. <input name="file6" type="file"><br>
    7. <input name="file7" type="file"><br>
    8. <input name="file8" type="file"><br>
    <input type="submit" value="Upload">
    </form>

  • #3
    New to the CF scene
    Join Date
    May 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the tip about JS, it explains why nothing was forth coming.

    Also thank you for the code, its close to what I am looking for, I just left out an important detail. I am trying to build something where a user could hit the browse button and then select a bunch of files at once (like holding down the shift button). If the user could select the files and it returned a string or an array, I could split them into single entries for upload much like the 8 line example you posted.

    The built in file select box for html doesnt support this, but are there any other file explorer like things that i could have popup allowing users to select different files?

    Thanks again!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •