ajax文件上传

$.ajaxFileUpload({  
	            url: '${dynamicDomain}/screenshot/uploadImage?ajax=1',  
	            secureuri: false,  
	            fileElementId: 'uploadFile1',  
	            dataType: 'json',  
	            success: function(json, status) {
	                if(json.result=='true'){
	                    var filePath = json.filePath;
	                    var img = '<a style="float: right;cursor: pointer;" id="mainDelete" data-path="'+filePath+'">删除</a>'+
	                    '<img alt="" src="${dynamicDomain}'+filePath+'" width="100px" height="100px;">';
	                    $("#mainPicture").val(filePath);
	                    $("#mainImg").html(img);
	                    bindPictureDelete();
	                }else{
	                    alert(json.message);
	                }
	            },error: function (data, status, e)//服务器响应失败处理函数
	            {
	                alert(e);
	            }
	        }  
	    );


你可能感兴趣的:(ajax文件上传)