如何预加载现有文件并将它们显示在 blueimp 上传表中? [英] How to I preload existing files and display them in the blueimp upload table?

查看:19
本文介绍了如何预加载现有文件并将它们显示在 blueimp 上传表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 jquery-ui 版本的 Blueimp 上传,我喜欢如何格式化表格并显示刚刚上传的文件.但我也想将它用作文件管理器,所以我想预加载现有文件并显示,而不是像刚刚上传一样.我怎样才能做到这一点?指向其他人解决此问题的示例链接就足够了.顺便说一句,我正在上传几种不同的文件类型,而不仅仅是图像.

I am using the jquery-ui version of Blueimp upload and I like how I can format a table and display files that were just uploaded. But I'd like to use it as a file manager as well so I want to preload existing files and display than as if they were just uploaded. How can I do that? A sample link to where someone else has addressed this would suffice. BTW, I am uploading several different file types, not just images.

谢谢!

推荐答案

我也遇到了同样的问题.它的工作原理并不神奇.我建议检查 UploadHandler.php 文件.然后你就可以根据自己的需要修改这个插件了.

I also had the same problem. It is not magic how it works. I recommend to examine the UploadHandler.php file. Then you will be able to modify this plugin accordind to your needs.

您第二篇文章中的上述代码只是对上传器脚本(默认为 server/php/文件夹中的 index.php)的 ajax 调用.$.ajax 对象中的调用方法默认设置为get".

The code above in your second post is just an ajax call to the uploader script (by default index.php in server/php/ folder). The call method is set to "get" by default in $.ajax object.

打开 UploadHandler.php 文件并转到类方法initialize(...)".您将看到如何处理带有get"的调用.UploadHandler 调用类方法 this->get(.:.) 来准备和发送现有文件的列表.如果使用其他上传目录,则需要向 UploadHänder 传递一个参数.只需更改 $.ajax 对象中的 url 属性,例如:

Open the UploadHandler.php file and go to the class method "initialize(...)". You will see how the call with "get" handled. UploadHandler calls the class method this->get(.:.) to prepare and send the list of existing files. If you use other upload directory, you need pass a parameter to the UploadHänder. Simply chage the url property in the $.ajax object like :

url: $('#fileupload').fileupload('option', 'url')+'?otherDir='+myDir,

那么你应该在创建一个新的 UploadHandler 对象之前初始化 UploadHandler 的 option 属性,如下所示:

then you should initialize the option property of the UploadHandler before you create a new UploadHandler object like this:

$otherDir = trim($_REQUEST['otherDir']);
$otherDir_url = [anyURL] .'/'.$otherDir;//so that the files can be downloaded by clicking on the link

$options = array(
'upload_dir'=> $otherDir,
'upload_url'=> $otherDir_url,
);

$upload_handler = new UploadHandler($options);

这篇关于如何预加载现有文件并将它们显示在 blueimp 上传表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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