Click photos to upload photos two

Source: Internet
Author: User

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

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.