I’m creating a file upload/edit tool for a photography company where the users should be able to upload multiple photos, view them, select some options for each of them, then go to the shopping cart and pay for their order. I want to only actually upload the photos to the server after they’ve submitted the shopping cart, so that’s a few steps later. I also want them to be able to go back to the editing page and see the photos they upload and change the options before going back to the shopping cart. I’d like to save the photos in cookies or in the php $_SESSION variable or somewhere else so that I can still access them after the page has been refreshed or the user has navigated somewhere else on the site.
I’m using JavaScript and PHP
What I’m doing right now is, using javascript, when the files are dropped into the box, the file type input receives the files and then for each file, i create a div with the image in it and use
URL.createObjectURL(file)
to get the local path for the file. This works, the images do appear. My problem is that after submitting the form, I don’t know how to save the files in order to later be able to access them in the same way. I’m now saving the URL.createObjectURL(file) in a cookie, but then when i access that cookie with javascript, the path no longer works.