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

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

问题描述

我正在尝试使用blueimp jquery-file-upload插件。
似乎是一个很好的上传器,但文档是没有帮助的。



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

我试图改变,在index.php,行动路径,如下所示:

  form id =fileuploadaction =../ uploads /method =POSTenctype =multipart / form-data

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



GET调用可以,正如我在Firebug中可以看到的那样:

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

但是当我启动上传操作时,POST会回复我(仍然在Firebug中):
$ b $ pre $ POST http:// localhost / alliance_pretests / uploads / 404未找到44ms

我没有改变任何东西。
我忘记了什么?



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

提前致谢。
最好的问候。

解决方案

表单操作不是您的上传文件夹应该在的文件夹。表单动作是提交后发送数据的脚本。 (有关表单操作的更多信息,请参阅 http://www.w3schools.com/tags/att_form_action.asp ) / p>

尝试找到上传的目标文件夹,或者查看脚本中的内容。

更新:after下载库



您应该查看server / php / upload.class.php,并且在上传文件夹的位置有一些变量:

 'script_url'=> $ this-> getFullUrl()。'/',
'upload_dir'=> dirname($ _ SERVER ['SCRIPT_FILENAME'])。'/ files /',
'upload_url'=> $ this-> getFullUrl()。'/ files /',

$ c> / files / 与您自己的上传文件夹。


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.

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.

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

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

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 ?

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

Thanks in advance. Best regards.

解决方案

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.

Update: after downloading the library

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/',

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

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

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