Plupload limit the number of uploads can only select one image upload

Source: Internet
Author: User

var files=[];var errors=[];
var chunk=<%=request.getparameter ("Chunk")%>;
var root= "", xml= "";
var max_file_size= ' 20MB ';
var image= ' <%=request.getparameter ("image")%> ';
var id= ' <%=request.getparameter ("id")%> ';
var flag= ' <%=request.getparameter ("flag")%> ';
var condir= ' <%=request.getparameter ("Condir")%> ';
var filters={title: "Allowed file Type", Extensions: "Jpg,gif,png"};
$ ("#uploader"). Pluploadqueue ($.extend ({
Runtimes: ' Flash ',
URL: ' <%=path%>/uploaderxing?id= ' +id+ ' &flag= ' +flag+ ' &condir= ' +condir+ ' &image= ' +image,
Max_file_size:max_file_size,
File_data_name: ' File ',
Unique_names:true,

Only one file or picture can be selected in the selected flash
Multi_selection:false,
Filters:[filters],
Flash_swf_url: ' <%=path%>/upload/plupload/plupload.flash.swf ',
init:{
Fileuploaded:function (uploader,file,response) {
if (response.response) {
var rs = $.parsejson (response.response);
if (rs.status) {
xml+= ' <name><! [cdata[' +file.name+ ']]></name> ';
xml+= ' <size> ' +file.size+ ' </size> ';
xml+= ' <newName> ' +rs.newname+ ' </newName> ';
xml+= ' <savePath> ' +rs.savepath+ ' </savePath> ';
Files.push (XML);
}else{
Errors.push (File.name);
}
}
},

When you add this method, you can upload only one file or a picture.
Filesadded:function (uploader, files) {
$.each (uploader.files, function (i, file) {
if (uploader.files.length <= 1) {
Return
}
Uploader.removefile (file);
});
},
Uploadcomplete:function (UPLOADER,FS) {
Window.parent.location.reload ();
Window.parent.reloadJQGrid ();
Target.window ("close");
}
}
},
(chunk?) {chunk_size:max_file_size}:{}));

Plupload limit the number of uploads can only select one image upload

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.