Redisplaying upload field value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jankie
    New Member
    • May 2007
    • 58

    Redisplaying upload field value

    I have a form that redisplays user input for checking before the final submission.
    i got all values redisplayed except the selected file for upload.
    While i can have something like this in other fields:
    [code=html]
    <INPUT type="text" name="First Name" value="<?=$_POS T['First_Name']?>"
    [/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]

    [code=html]
    I dont know how to do the same thing for the upload field:
    <input name="MAX_FILE_ SIZE" type="hidden" value="100000">
    <input name="userFile" type="file"><br >
    <input name="submit" type="submit" value="Submit">
    [/code]
    Thank you for your support
    Last edited by pbmods; Jun 10 '07, 02:35 PM. Reason: Added code tags.
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    u can find your answer here: http://www.php.net/features.file-upload

    it will help u store the file as well, and how to protect yourself too

    Comment

    • Jankie
      New Member
      • May 2007
      • 58

      #3
      Thanks,but the mentioned article didnt address what i mentioned above,
      Anybody else?

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        Originally posted by Jankie
        I have a form that redisplays user input for checking before the final submission.
        i got all values redisplayed except the selected file for upload.
        While i can have something like this in other fields:
        <INPUT type="text" name="First Name" value="<?=$_POS T['First_Name']?>"
        Yeah this line will print the text values you got from the POST method.
        So, what do do you need to print from this.

        [HTML]<input name="userFile" type="file">[/HTML]

        is it contents of the file,or name of the file ? or something else?
        and where you want to redisplay them.In a form field ?

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          I would recommend changing your form design. If a User were to provide an invalid first name, for instance, he shouldn't have to re-upload his file.

          If the file he provided was invalid, then it wouldn't make sense to repopulate the file input anyway. And all browsers that I know of will save the User's last selection in the Open dialog when he clicks on the 'Browse...' button in a file input.

          Comment

          Working...