如何创建用于Fine Uploader API的文件Blob [英] How to create a file blob for use with Fine Uploader api
问题描述
我正在使用cordova-imagePicker在Android上获取本地网址,并通过cordova-file-transfer插件上传了本地网址。我想切换到Fine Uploader,以便可以使用可恢复功能,但是我能找到的唯一api方法需要文件blob。如何在给定文件路径的情况下创建合适的Blob,或者Fine Uploader中是否有将采用路径的api?
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?
推荐答案
通过API以编程方式将文件添加到Fine Uploader的唯一方法是 addFiles()
函数。它允许您添加 File
s,< input>
s, Blob
, BlobWrapper
对象,< canvas>
es或 CanvasWrappers
。
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
.
当前在HTML5中无法从本地文件系统上的路径创建对文件的引用。我的建议是寻找在Cordova / Phone Gap中创建HTML5 File对象(或另一个兼容的 addFiles
参数)的方法。抱歉,但是我有0点经验。
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.
FileEntry.file 属性似乎很有希望。
这篇关于如何创建用于Fine Uploader API的文件Blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!