christamcc
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:
That didn't seem to work.
Suggestions?
Thanks!
<input type="file" name="file" id="file" value="<?php if (isset($_FILES["file"]["tmp_name"])) echo $_FILES["file"]["tmp_name"]; ?>" />
That didn't seem to work.
Suggestions?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.