Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store an image file in IndexedDB

I'm having issues trying to store an image file in IndexedDB, I grab the file object and try and push that into IndexedDB but it seems to throw an error:

DOM Exception: DATA_CLONE_ERR (25)

How can I convert the file object, which looks like this (below) to something I can store in indexedDB and retrieve from indexedDB at a later date?

attribute: 32
contentType: "image/png"
displayName: "image1"
displayType: "PNG File"
fileType:    ".png"
name:        "image1.png"
path:        "C:\pictures\image1.png"
like image 758
CLiown Avatar asked May 14 '12 15:05

CLiown


1 Answers

IndexedDB supports storing blobs in Firefox and Chrome. There is available example on storing images to IndexedDB. The code works fine with the newest version of Chrome and Firefox. Hope it helps.

like image 169
stefan Avatar answered Sep 23 '22 22:09

stefan