Link to home
Start Free TrialLog in
Avatar of christamcc
christamccFlag for United States of America

asked on

PHP Populate input type=file field from stored value

When there is an error on the form I add the values back in the fields so the user doesn't have to renenter them.  All fields work fine except my file field.   I tried something like this:

<input type="file" name="file" id="file"  value="<?php if (isset($_FILES["file"]["tmp_name"])) echo $_FILES["file"]["tmp_name"]; ?>" />

Open in new window


That didn't seem to work.

Suggestions?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Gary's right, you can't preset a 'file' field.  That is to prevent someone from loading one of your files against your will.
What GaryC123 and DaveBaldwin said.  No points for this answer, please, but consider the implications if a server-side script could read anything it wanted from your PC.  If you figure out a way to prepopulate the contents of $_FILES the security experts will shut your method down as quickly as they can find it.  Don't build an application that needs to rely on this kind of security hole.