0

I have a very basic form which posts images to a PHP script, I use it to upload images to my server.

The problem I have is that when I return to my form at a later date I want it to remember the file I uploaded to my server. I can do this with text inputs by caching the input values in a cookie, can I do something similar for file inputs?

2
  • 2
    AFAIK Your script will never receive the full path to the file that the user uploads. So, in short, no. Commented Dec 7, 2012 at 13:54
  • 1
    This sort of thing would constitute a security violation. At best, you could find out where it was uploaded TO and save that... Commented Dec 7, 2012 at 13:55

2 Answers 2

5

The answer is no. This is due to the security implications if the form remembers paths.

Sign up to request clarification or add additional context in comments.

Comments

2

Not with a form, as the others have pointed out. You might be able to fulfill your requirement with a Flash or Java applet which does the upload for you and may be able to remember the path itself (e.g. in a cookie). However this isn't exactly lightweight and will trigger some security popup in most browsers. This may turn away users from your site.

I assume you want this for convenience, so users can upload multiple files with ease. You might want to provide a drag & drop file upload (e.g. as outlined in this tutorial http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/). This would improve your usability while keeping within the boundaries enforced by browser security.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.