CLiown
CLiown

Reputation: 13843

PHP Image upload form

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?

Upvotes: 0

Views: 180

Answers (2)

Jan Thomä
Jan Thomä

Reputation: 13604

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.

Upvotes: 2

Ed Heal
Ed Heal

Reputation: 59987

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

Upvotes: 5

Related Questions