Skip to content
Advertisement

How can I locally save images and batch upload them using another PHP function?

I am building a simple website where a user can upload multiple images and afterward click on a button to batch upload them to an AWS S3 bucket using PHP. Therefore the images need to be stored locally but also be accessible by PHP. So far I’ve learned that cookies are too small to store images and that the localstorage is not accessible using PHP.

This I what I’ve done so far:

JavaScript

The issue here is that when I try to log the cookies, it just says: img_1=data:image/jpeg; instead of showing me the base64 string. I’d like to save the images on the phone before uploading them for performance reasons. Previously I had to wait about 10 seconds after taking an image until I could capture another one. Are there any other ways to do this without cookies or localstorage?

Advertisement

Answer

Images on a user’s local machine are never accessible to php as it runs on the server. You should look into creating an upload functionality using either HTML forms or JavaScript.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement