以编程方式将FineUploader传递给要上传的文件的位置 [英] programmatically passing FineUploader the location of the file to upload

查看:56
本文介绍了以编程方式将FineUploader传递给要上传的文件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经原型化了一个客户端程序,该程序可以让用户选择本地文件夹,创建一个zip,然后通过本地Web套接字让本地浏览器知道该zip文件的位置.然后打算将这个新的zip文件位置告诉fineUploader,以便它可以立即开始上传过程.

We have prototyped a client-side program that lets users select a local folder, creates a zip, then lets the local browser know about the zip file location via a local web socket. The intention is to then tell fineUploader about this new zip file location, so that it can immediately start the upload process.

但是我不清楚如何进行切换的最后一部分.我刚刚看到了这篇文章听起来令人担忧.

But I'm not clear how to make this last part of the handoff. I just saw this post which sounds concerning.

有什么办法吗?如果不是,那么如果用户选择了一个目录,并已将其压缩,并且我们希望fineUploader组件能够处理上传,那么我们如何才能获得可接受的用户体验?

Is there any way? If not, how might we make an acceptable user experience given that the user has selected a dir, it has been zipped for them, and we want the fineUploader component to process the upload?

谢谢!

斯图

推荐答案

在浏览器中运行的代码无法直接访问您的文件系统.如果要上传文件,则用户必须通过拖放或<input type="file">选择器对话框手动选择这些文件.

Code running in the browser is not able to access your filesystem directly. If you want to upload files, your users will have to manually select these files via drag-and-drop or an <input type="file"> chooser dialog.

但是,如果可以通过HTTP或WS访问zip文件,则可以这样做.假设使用HTTP,则可以对zip文件将其读入Blob ,然后通过

However, if the zip file is accessible via HTTP or WS, this is possible. Assuming HTTP, you can make an ajax GET request for the zip file, read it into a Blob, and then send this Blob to Fine Uploader via the addFiles API method. If you're reading the file over WS, you'll need to take the returned data and convert it to a Blob using FileReader.

请注意,在IE10之前的浏览器中这是不可能的.

Note that this is not possible in browsers older than IE10.

这篇关于以编程方式将FineUploader传递给要上传的文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆