How to create a file blob for use with Fine Upload

2019-08-20 03:54发布

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条回答
我想做一个坏孩纸
2楼-- · 2019-08-20 04:48

The only way to programmatically add files to Fine Uploader via the API is the addFiles() function. It allows you to add Files, <input>s, Blobs, 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.

查看更多
登录 后发表回答