according to the weui.js document example;
var uploadCount = 0;
weui.uploader("-sharpuploader", {
url: "http://localhost:8081",
auto: true,
type: "file",
fileVal: "fileVal",
compress: {
width: 1600,
height: 1600,
quality: .8
},
onBeforeQueued: function(files) {
// `this` , `files`
if(["image/jpg", "image/jpeg", "image/png", "image/gif"].indexOf(this.type) < 0){
weui.alert("");
return false; //
}
if(this.size > 10 * 1024 * 1024){
weui.alert("10M");
return false;
}
if (files.length > 5) { //
weui.alert("5");
return false;
}
if (uploadCount + 1 > 5) {
weui.alert("5");
return false;
}
PPuploadCount;
// return true; //
},
onQueued: function(){
console.log(this);
// console.log(this.status); // :"ready", "progress", "success", "fail"
// console.log(this.base64); // base64file.base64base64
// this.upload(); // upload;
// this.stop(); //
// return true; //
},
onBeforeSend: function(data, headers){
console.log(this, data, headers);
// $.extend(data, { test: 1 }); //
// $.extend(headers, { Origin: "http://127.0.0.1" }); //
// return false; //
},
onProgress: function(procent){
console.log(this, procent);
// return true; //
},
onSuccess: function (ret) {
console.log(this, ret);
// return true; //
},
onError: function(err){
console.log(this, err);
// return true; //
}
});
does not achieve the manual upload I want.
this.upload ();
can upload manually; but I don"t understand.
ask the boss for advice! Thanks!