jeudi 5 novembre 2015

Storing a file object in application cache using javascript

<input type="file" onchange="angular.element(this).scope().file_changed(this)">

I want to give user the ability to rename a file one has selected. Input type 'file' provides a file object, but the path of the file object is not one of the properties. Also, changing properties of this file is not permitted. (Ref. a lot of answers on stackoverflow)

"{"webkitRelativePath":"","lastModified":1446544642000,"lastModifiedDate":"2015-11-03T09:57:22.000Z","name":"pdf-sample.pdf","type":"application/pdf","size":7945}"

But it is achievable with files chosen using some plugins e.g. camera or image-picker. And I think the trick lies in : copying the file to application cache and then edit properties.

I would like to know how can I copy a file to application cache if I don't have it's path (preferably using core plugins). I'm also open to any better approach.

Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire