问题
I'm using the cordova-imagePicker to get a local URL on Android and I'm uploading it with the cordova-file-transfer plugin. I would like to switch to Fine Uploader so I can make use of the resumable feature but the only api method I can find takes a file blob. How do I create a suitable blob given the path to a file or is there an api in Fine Uploader that will take a path?
回答1:
The only way to programmatically add files to Fine Uploader via the API is the addFiles() function. It allows you to add File
s, <input>
s, Blob
s, BlobWrapper
objects, <canvas>
es, or CanvasWrappers
.
There is no way in HTML5, currently, to create a reference to a file from a path on the local file system. My suggestion is to search for ways to create an HTML5 File object (or another compatible addFiles
parameter) in Cordova/Phone Gap. Sorry, but I have 0 experience with those.
The FileEntry.file property seems promising.
来源:https://stackoverflow.com/questions/30067282/how-to-create-a-file-blob-for-use-with-fine-uploader-api