简体   繁体   English

使用jQuery-File-Upload插件以正常方式上传

[英]Upload Like Normal using the jQuery-File-Upload plugin

I am wanting to use the jQuery-File-Upload plugin located here https://github.com/blueimp/jQuery-File-Upload . 我想使用位于https://github.com/blueimp/jQuery-File-Upload的jQuery-File-Upload插件。 I have implemented it for the most part but I am having trouble actually submitting the form. 我已经实现了大部分,但是我在提交表单时遇到了麻烦。 What I would like to do is when the user clicks on "Upload", instead of uploading it to a default directory on my server, I would like the page to POST so I can verify the files and then store them on my server. 我想做的是,当用户单击“上传”时,我希望页面可以开机自检,而不是将其上传到服务器上的默认目录,以便我可以验证文件,然后将其存储在服务器上。 Is this possible to do with this plugin? 这可能与这个插件有关吗?

According to https://github.com/blueimp/jQuery-File-Upload/wiki/API it looks like you should be able to set an upload handler end point using a url parameter during initialization. 根据https://github.com/blueimp/jQuery-File-Upload/wiki/API看来,您应该能够在初始化期间使用url参数设置上传处理程序端点。 I would image you could point that to a php/aspx/anything else location and handle it in there. 我会想象您可以将其指向php / aspx /其他任何位置并在那里进行处理。

The File Upload widget is initialized by calling the fileupload method on a jQuery collection with the target HTML element: 通过使用目标HTML元素在jQuery集合上调用fileupload方法来初始化文件上载小部件:

 $('#fileupload').fileupload(); 

The target element is usually a container element holding the file upload form, or the file upload form itself, but it can also be just the file input element itself, if an url is provided as options parameter. 目标元素通常是一个包含文件上载表单的容器元素,或者文件上载表单本身,但是如果提供URL作为options参数,它也可以仅仅是文件输入元素本身。

The initialization method's first argument is an object that allows you to initialize the widget with various Options: 初始化方法的第一个参数是一个对象,该对象使您可以使用各种选项来初始化小部件:

 $('#fileupload').fileupload({ url: '/path/to/upload/handler.json', sequentialUploads: true }); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM