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 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    about <input type=file>

    the code is:
    <input type="file" name="userFile2" size="80" value="C:\" onkeypress="KeyPress()">

    But the "C:\" does not show in the text area. Who knows how to show it.

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can't set the value attribute of file upload form elements for security reasons. Consider this: someone could set the default value to a sensitive file, for example, a password file, then call the form element's submit method (or hide the element and let the user submit the form), and thus uploading senstivie data to the server. By not being able to set the value attribute of these kind of elements prevents this from happening. Moreover, when you select a file from the dialog, it will print the complete path in the textbox (rendering setting the value attribute useless), you also need to consider not everyone uses Windows as their operating system. I, for example, run Red Hat Linux, and there is no such thing as C:\ here.
    Last edited by fredmv; 01-14-2004 at 05:43 AM.

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    What fredmv said. The value attribute of file input is read-only.

  • #4
    New Coder
    Join Date
    Jan 2004
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanks

    Thank all of you to reply the question. But may I use Cookies to record the path, and to be shown next time the user open the page?

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Yes of course, as long as you don't display it in a file field. Search for cookie-related threads in this forum or google for cookie scripts if you don't have any.


  •  

    Posting Permissions

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