|
图片上传时怎么获取图片的大小,现在的代码是:
var serverMsg="";
$(function(){
$('#fileUrl').uploadify({
buttonText:'添加文件',
auto:false,
progressData:'speed',
multi:true,
height:25,
overrideEvents:['onDialogClose'],
fileTypeDesc:'文件格式:',
fileTypeExts: '*.jpg;*.png;',
queueID:'filediv_file',
fileSizeLimit:'15MB',
swf:'plug-in/uploadify/uploadify.swf',
uploader:'hAqscFxybsPmbzController.do?saveFiles',
onUploadStart : function(file) {
var cgFormId=$("input[name='id']").val();
var fileName=$("input[name='fileName']").val();
$("#fileName").val(file.name);
filenamess= $("#fileName").val();
// var width=file.width;
// var height=file.height;
// alert(width+" "+height);
$('#fileUrl').uploadify("settings", "formData", {
'cgFormId':cgFormId,
'cgFormName':'h_aqsc_fxybs_pmbz',
'cgFormField':'FILE_URL',
'cg_fileName':filenamess
});
} ,
onQueueComplete : function(queueData) {
var win = frameElement.api.opener;
win.reloadTable();
win.tip(serverMsg);
frameElement.api.close();
},
onUploadSuccess : function(file, data, response) {
var d=$.parseJSON(data);
if(d.success){
var win = frameElement.api.opener;
serverMsg = d.msg;
}
},
onFallback: function() {
tip("您未安装FLASH控件,无法上传图片!请安装FLASH控件后再试")
},
onSelectError: function(file, errorCode, errorMsg) {
switch (errorCode) {
case - 100 : tip("上传的文件数量已经超出系统限制的" + $('#file').uploadify('settings', 'queueSizeLimit') + "个文件!");
break;
case - 110 : tip("文件 [" + file.name + "] 大小超出系统限制的" + $('#file').uploadify('settings', 'fileSizeLimit') + "大小!");
break;
case - 120 : tip("文件 [" + file.name + "] 大小异常!");
break;
case - 130 : tip("文件 [" + file.name + "] 类型不正确!");
break;
}
},
onUploadProgress: function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {}
});
});
|
|