0

I'm using $localStorage service to store data in browser's cache. Actually I'm building a web application ( in angularjs and PHP ) on which user can upload multiple images on canvas, manipulate with them. What I was doing, when user uploads image/s, I was uploading this image to server and when user removes, I am unlinking it from the server but this approach only increases my server space with MBs/GBs of garbage data.

I'm looking to change my approach. Can I upload bulk of images on localStorage and when user submits his/her campaign, only then all of the images will send to the server ? Is there any approach can I go with ?

Vineet
  • 4,525
  • 3
  • 23
  • 42

1 Answers1

1

You can do it, and you can read about the sole technicalities of how to achieve that in the answer to this question: How to save an image to localStorage and display it on the next page? (basically it boils down to saving a Base64-encoded image as a string)

Mind that most browsers can only store up to several MB of data (depending on each browser, e.g. 5 for Chrome) in localStorage, so you will be limited by that.

Community
  • 1
  • 1
Tomek Sułkowski
  • 7,081
  • 2
  • 17
  • 15