uploadify插件-支持IE8以下

js代码:

	
	

$(document).ready(function(){

    $('#sendToImg').uploadify({
        swf: ctxStatic+'/ewider/js/iejs/uploadify.swf',
        uploader : window.parent.getUploadServer(),
        auto: true,
        checkExisting:false,
        fileSizeLimit:"20MB",
        fileObjName:"file",
        width: "30",
        height: "30",
        buttonClass:"hide",
        buttonText: " ",
        fileTypeExts:"*.gif;*.jpg;*.jpeg;*.bmp;*.png",
        onUploadSuccess :function(file, data, response) {
            var result = JSON.parse(data);
            sendImage(result.attachmentId,result.fileName);
        },
        onUploadError : function(file, errorCode, errorMsg, errorString) {
            alert("文件上传不了");
        }
    });

    $('#sendFile').uploadify({
        swf: ctxStatic+'/ewider/js/iejs/uploadify.swf',
        uploader : window.parent.getUploadServer(),
        auto: true,
        checkExisting:false,
        fileSizeLimit:"20MB",
        fileObjName:"file",
        width: "30",
        height: "30",
        buttonClass:"hide",
        buttonText: " ",
        onUploadSuccess :function(file, data, response) {
            var result = JSON.parse(data);
            sendFile(result.attachmentId,result.fileName);
        },
        onUploadError : function(file, errorCode, errorMsg, errorString) {
            alert("文件上传不了");
        }
    });

});



搞定:如果需要修改按钮的样式的话:用buttonClass属性或者直接更改按钮图片

你可能感兴趣的:(javaweb)