This has almost gave me a big headache.
I have a form,
when a user fills some part of it wrong, like enter bad type for email address the form loads again and tell him to fix his email, then other fields will remain the thing the user had typed, for example :
CODE
<input type="text" name="username" value="$_POST[username]" />
the code above will keep the username in the field.
Now the problem is,
I have an fileuploading field (for image). when the form is iewed again for user to correct his mistakes, I don't know how to keep his previously uploaded file :/
for example :
<input type="file" name="image" value=? there's no such value for that.
How can I keep this file temporary so that the user don't have to upload again his file ?
I mean temporary because maybe he dont' submit his form after he got errors, so if i save the file on the server, and he changes his mind, there would be a useless file on my server and I don't wanna use cron job to create an script to search for uselss files and delete them.
Is it possible I store a file in a PHP session???
What other people do in these cases?