<input type= "file" id= "cover" name= "Cover" style= "Display:none;" />
<input type= "button" onclick= "Selectdo ()" value= "Browse ..."/><span id= "text" ></span>
<input type= "hidden" id= "Picurl" required name= "Picurl" >
$ ("#cover"). FileUpload ({
URL: "${ctx}/wxmmsglog/upload",//File upload address, of course, can also be directly written in the Data-url attribute of input
FormData: {sendtype: "${wxmmsglog.sendtype}", Service: "${service}"},//if additional parameters need to be added can be added here
$ ("#img1"). attr ("src", data.imgurl);
Done:function (E, result) {
Send to background download down show
$ ("#picUrl"). Val (result.result["Picurl"]);
The address you downloaded to
*//* $ ("#img1"). attr ("src", "
${ctx}/upload/"+result.result[" FilePath "]);
Set the value *//*
}
})
$ (document). Ready (function () {
$ ("#edit_mass_form"). Validate ({
/* Ignore: "",
Onfocusout:true,
Errorplacement:function (Error, Element) {
if (element.attr ("name") = = = "Picurl")
Error.insertafter ("#text");
Else
Error.insertafter (Element);
}*/
});
/* $ (' #selectFile '). Bind (' click ', function () {
var ie =!-[1,];
if (IE) {
$ (' #cover '). Trigger (' click '). Trigger (' change ');
} else {
$ (' #cover '). Trigger (' click ');
}
});
$ (' #cover '). Change (function () {
$ ("#text"). Text (this.value);
});*/
});
/* Function Selectdo () {
$ ("#cover"). Trigger (' click ');
}*/
Use the analog input file to trigger open files when the button is clicked. Gets the name of the file when the change is selected in the button
Write a span to write the name of the file and save Picurl validation: Unhide validation when the name is =picurl, he selects it.
Upload a picture if you haven't uploaded it, add an error message after span
Jqueryfileupload Plug-in