jquery-file-upload 插件:如何更改上传路径?
我正在尝试使用 blueimp jquery-file-upload 插件。 似乎是一个很好的上传器,但文档没有帮助。
当我使用可下载的演示脚本时,一切正常。 但是,当我想更改上传路径时,这不起作用。
我尝试在index.php中更改操作路径,如下所示:
form id="fileupload" action="../uploads/" method="POST" enctype="multipart/form-data"
并在我的“上传”文件夹中添加文件夹“文件”和“缩略图”。
GET 调用没问题,正如我在 Firebug 中看到的那样:
GET http://localhost/alliance_pretests/uploads/ 200 OK -8ms
但是当我启动上传操作时,POST 回答了我(仍在 Firebug 中):
POST http://localhost/alliance_pretests/uploads/ 404 Not Found 44ms
我没有更改任何其他内容。 我忘记了什么?
为什么 GET 调用可以看到文件夹,但 POST 调用看不到?
提前致谢。 此致。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然 @mugur 提供的答案是正确的,但查看库提供的 php 类,构造方法中的第一个参数是“选项”,并按如下方式声明关联数组:
并在实例化该类时将其作为第一个参数传递:
将允许您在每次使用该类时更改上传目录,而不是更改源代码。
Although the answer @mugur supplied is correct, looking at the php class supplied with the library the first parameter in the construct method is "options" and by declaring an associative array as follows:
and passing it as the first parameter when instantiating the class:
Will allow you to change the upload directory every time you use the class rather than altering the source code.
表单操作不是您的上传文件夹所在的文件夹。表单操作是提交后发送数据的脚本。 信息 http://www.w3schools.com/tags/att_form_action.asp)
(在此处查看有关表单操作的更多 找到上传的目标文件夹或查看脚本内部。
更新:下载库后
您应该查看 server/php/upload.class.php,其中有一些带有上传文件夹位置的变量:
Tou 应该替换
/files/< /code> 与您自己的上传文件夹。
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:
Tou should replace
/files/
with your own upload folder.