Load picture Check
function LoadImage (IMG) {
var filePath = Img.value;
var fileext = filepath.substring (Filepath.lastindexof ("."))
. toLowerCase ();
if (!checkfileext (Fileext)) {
Parent.layer.msg (' Your uploaded file is not a picture, please re-upload! ', {icon:5});
Img.value = "";
return false;
}
if (Img.files && img.files[0]) {
Parent.layer.msg (' You choose the file Size ' + (img.files[0].size/1024/1024). toFixed (2) + "M", {icon:1});
if ((img.files[0].size/1024/1024). toFixed (2) >5) {
Parent.layer.msg (' The file you selected is too large (' + (img.files[0].size/1024/1024). toFixed (2) + "M)", {icon:5});
return false;
}
} else {
Img.select ();
var url = document.selection.createRange (). text;
try {
var fso = new ActiveXObject ("Scripting.FileSystemObject");
} catch (e) {
Parent.layer.msg (' If you are using IE8 below please lower the security level! ', {icon:5});
}
Parent.layer.msg ("File Size:" + (FSO. GetFile (URL). size/1024). toFixed (0) + "KB", {icon:5});
return false;
}
return true;
}
Suffix
function Checkfileext (EXT) {
if (!ext.match (/.jpg|. Gif|. Png|. bmp/i)) {
return false;
}
return true;
}
Determine upload file type, upload image