Tech Kid
Tech Kid

Reputation: 577

AngularJS: Upload image and save in local storage

Hi My current scenario is that: I want to have functionality like this: I want to to have a <input type=file> in my html and when i click on submit or upload. it move the file into local storage directory.. then after 4-5 file savings. it check that localstorage directory, read the files/images that are in the storage then upload to the specific URL.

Also i want to create the directory into localstorage too in the begining of application.

Upvotes: 0

Views: 2359

Answers (1)

Jeremy Rajan
Jeremy Rajan

Reputation: 662

You can use, FileReader api in browsers. And then save the resulting date encoded image to localstorage in a specified directory.

refer: https://developer.mozilla.org/en/docs/Web/API/FileReader

I have done something similar, but without localstorage. Might help.

https://github.com/jeremyrajan/photoStickerUpload (repo) https://github.com/jeremyrajan/photoStickerdemo (demo)

This might help, as a lib: https://github.com/gsklee/ngStorage (for localstorage)

Hope that helps!

Upvotes: 1

Related Questions