One picture two, code
<body>
<div class= "Fft-wrapper" >
<form id= "SubmitForm" action= "" method= "POST" >
<div class= "Form-wrapper" >
<ul class= "Upload-wrapper" >
<li class= "title" > Upload door head photo </li>
<div class= "Upload-img" >
<div class= "Tip fr" >
<input onclick= "Uploadbtnouter ();" value= "Upload picture" >
<input type= "File" Name= "Uploadouter" style= "Display:none" onchange= "previewimgouter (this);" Id= "UploadOuter" accept= "image/*"/>
</div>
</div>
</ul>
</div>
</form>
</div>
<script>
var lib = {flexible:{rem:150,page:750}};
</script>
<script type= "Text/javascript" src= "Js/ajaxfileupload.js" ></script>
<script type= "Text/javascript" >
function Uploadbtnouter () {
$ ("#uploadOuter"). Click ();
}
Picture Preview previewimg (this);
function Previewimgouter (imgfile) {
var extension = imgFile.value.substring (ImgFile.value.lastIndexOf ("."), imgFile.value.length);//Extension
Extension = Extension.tolowercase ();//Convert file name extension to lowercase
if ((extension!= '. jpg ') && (extension!= '. gif ') && (extension!= '. jpeg ') && (extension!= '. png ') && (extension!= '. bmp ')) {
Layer.msg ("Sorry, the system only supports the standard format of photos, please adjust the format after re-upload, thank you!");
$ (". Btn-uploading"). focus ();//Position the focal point on the File Upload button, which can be triggered directly by pressing the OK key
}else{
var path;//preview Address
if (document.all) {//ie
Imgfile.select ();
Path = Document.selection.createRange (). text;
}else{//Firefox, Google
Path = window. Url.createobjecturl (Imgfile.files[0]);
}
$ ("#yushowOuter"). attr ("src", path);//Set preview address
Uploadimgouter (Imgfile);
}
}
function Uploadimgouter (imgfile) {
var file = imgfile.files[0];//Files Object
var name = file.name;//Picture name
var url = ' ${rc.contextpath}/wxffanapply.htm?method=uploadfile&state=outer ';
$.ajaxfileupload ({
Url:url,
Secureuri:false,
Type: ' POST ',
Fileelementid: "Uploadouter",
DataType: ' JSON ',
Success:function (data, status)//Server Success Response handler function
{
var index = Data.indexof (' {');
Data= data.substring (index, data.length);
var obj = eval (' (' + data + ') ');
if ("obj.code" = =) {
$ ("#fssIdOuter"). Val (Obj.fssid);
$ ("#originalFilenameOuter"). Val (Obj.originalfilename);
$ ("#imageTypeOuter"). Val (Obj.imagetype);
/* alert (OBJ.FSSID);
alert (obj.originalfilename);
alert (Obj.imagetype); */
Alert ("Upload success");
} else {
Alert ("Save problem, please retry");
}
},
Error:function (data, status, E)//server response failure handler function
{
Alert (e);
}
});
}
</script>
</body>
Click photos to upload photos two