jquery-file-upload 插件:如何更改上传路径? [英] jquery-file-upload plugin : How to change the upload path?

查看:45
本文介绍了jquery-file-upload 插件:如何更改上传路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 blueimp jquery-file-upload 插件.似乎是一个不错的上传者,但文档没有帮助.

I'm trying to work with the blueimp jquery-file-upload plugin. Seems to be a good uploader, but the documentation is not helpful.

当我使用可下载的演示脚本时,一切正常.但是,当我想更改上传路径时,这是行不通的.

When I work with the downloadable demo script, all is ok. But, when I want to change the upload path, that doesn't work.

我尝试在 index.php 中更改操作路径,如下所示:

I've tried to change, in index.php, the action path, like this :

form id="fileupload" action="../uploads/" method="POST" enctype="multipart/form-data"

并在我的上传"文件夹中添加文件夹文件"和缩略图".

and added the folders "files" and "thumbnails" in my "uploads" folder.

GET 调用没问题,正如我在 Firebug 中看到的那样:

The GET call is ok, as I can see in Firebug :

GET http://localhost/alliance_pretests/uploads/ 200 OK -8ms

但是当我启动上传操作时,POST 会回答我(仍在 Firebug 中):

But when I launch the upload action, the POST answers me (still in Firebug) :

POST http://localhost/alliance_pretests/uploads/ 404 Not Found 44ms

我没有改变其他任何东西.我忘记了什么?

I didn't change anything else. What did I forget ?

为什么 GET 调用会看到文件夹,而不是 POST 调用?

Why the GET call sees the folder, but not the POST call ?

提前致谢.最好的问候.

Thanks in advance. Best regards.

推荐答案

表单动作不是你的上传文件夹应该在的文件夹.表单动作是提交后发送数据的脚本.(在此处查看有关表单操作的更多信息 http://www.w3schools.com/tags/att_form_action.asp)

The form action is not the folder where your upload folder should be. The form action is the script where the data is sent after submitting. (see more here about form actions http://www.w3schools.com/tags/att_form_action.asp)

尝试找到上传的目标文件夹或查看脚本内部.

Try finding a destination folder for uploads or look inside the script for that.

更新:下载库后

你应该在 server/php/upload.class.php 中查看,那里有一些与上传文件夹位置有关的变量:

You should look in server/php/upload.class.php and there you have some variables with the location of the upload folder:

'script_url' => $this->getFullUrl().'/',
'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/',
'upload_url' => $this->getFullUrl().'/files/',

您应该将 /files/ 替换为您自己的上传文件夹.

Tou should replace /files/ with your own upload folder.

这篇关于jquery-file-upload 插件:如何更改上传路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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