Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

input type="file" value="x"

Options
  • 29-03-2006 7:32pm
    #1
    Closed Accounts Posts: 975 ✭✭✭


    I'm playing with file uploads in php. I have a form with various fields including 5 input type="file" fileds. I have a routine to check for duplicates, as well as other parsing logic.

    Now if there is an error in the form on submission, I redisplay the form and populate it with the data that was submitted last time, but this won't work for the file fields.

    If I do:
    <input type="file" name="x" <?php echo "value=" . $x; ?> >

    The raw HTML generated looks like:

    <input type="file" name="x" value="C:\about.jpg">

    But the file field is empty on the form.

    This link says it's a security thing:
    http://www.irt.org/script/1154.htm

    Are they right?
    Is there a workaround?
    I don't want the user having to reselect 5 files if there is an error.
    Thanks.


Comments

  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    Actually, the security restriction is that you can't set the value programmatically or with a default value. However, if you have a signed script, you can work around this. I've done it before, but can't remember how - you should be able to google it.


  • Closed Accounts Posts: 850 ✭✭✭DOLEMAN


    I'm nearly certain there is no work around for this.

    Considering: I write a script. Force an error to occur so the user has to reenter his password again. I then change the file upload path to point at a very private file...


Advertisement