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
    Regular Coder
    Join Date
    Jun 2002
    Location
    Lincoln (UK)
    Posts
    138
    Thanks
    3
    Thanked 0 Times in 0 Posts

    previewing local file before uploading

    Hi all,

    Hopefully someone can help, I've searched the forum but can't see anything obvious...

    I have a file upload script (which works fine) and would like to offer the user the ability to preview/check the file B4 actually uploading.
    Does anyone know how to extract the local address from the file field and use it to display the document locally?

    Thanks for any help/advice.

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I believe you can access the .value property of the input type="file" and just launch it. At least you can in IE-- this code is tested there.
    Code:
    <form action="#">
    <input type="file" id="myfile" name="myfile" />
    <button onclick="window.open(document.getElementById('myfile').value)">Preview</button>
    </form>

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Lincoln (UK)
    Posts
    138
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Many thanks, just what I was looking for. every varient I tried didn't work... easy when you know how.



  •  

    Posting Permissions

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