Web app woes: Save files offline for later upload to server

Ok, so this is something I like to do with a web application: make the users choose pictures when they are offline, and upload them later when they are online (even after the original page was closed). Easy? Not as far as I understand.

Data is easy to store locally in localstorage. But localstorage is not good for images. There’s a limit of 5 mb’s. FileApi? Yes, seems like a good candidate, but not on iOS Safari, which is a requirement, it cannot do filewrites.

My current shot is to keep the page open and keep the files in a DataForm variable until the user goes online again. The page must be kept alive. But I think we can live with that (it is a single page application). And in worst case, the users just need to find the images from the local disk again. Another alternative is to use createObjectUrl(), which generates a temorary url to a local file, the url is easy to store in localstorage. But, those urls are only valid during the document lifetime. Don’t understand why. Should at least be an option to keep them longer. A more robust alternative for the iPad would be to rely on some native application to keep the files for us. I think PhoneGap can do that, but I’m not sure.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s