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
    Oct 2008
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Where does "Browse" start for input type="file"

    I allow authorized users to upload files for the public to download. My php handler works as intended. It is called from the server with a simple HTML script using an input box with type="file". It is a complete mystery as to where the Browse button starts looking. Users ask me and I have no idea.

    Apparently, once a user selects a file, the next time he or she uses the script Browse starts at that last directory. This is different for each user, of course.

    Although the script and handler work, I feel rather strange not knowing how it works. Anyone know where the Browse button for the HTML input box starts or, better yet, how to control it?

  • #2
    Regular Coder
    Join Date
    Dec 2010
    Location
    California
    Posts
    201
    Thanks
    30
    Thanked 8 Times in 8 Posts
    The browse button is added by the browser, when the browser sees an input type of file it automatically adds the browse button for you and the browser tells that button to search a local directory when clicked. As far as manipulating the browse button, this can be done, but it's tricky if you don't know what your doing. Maybe this link can help you understand how to execute this.

    Link: http://www.quirksmode.org/dom/inputfile.html

  • #3
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I wondered which local directory the Browse button started with.
    Apparently is uses the last directory your browser accessed for a file. For example, in Firefox if one clicks File:Open File and actually opens a file, the Browser button starts with that directory.

    about:config browser.open.lastDir contains that information for Firefox.

    I don't know how to grab that information with Javascript or php.

    However, for our purposes I will just tell users to access (with their browser) the file they want to upload before using my script to actually upload to the server.

    Thanks for the comment.


  •  

    Posting Permissions

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