jQuery
文件上传带预览
function ajaxFileUploadview(imgid, hiddenid, url) { $.ajaxFileUpload({ url: url, secureuri: false, fileElementId: imgid, dataType: 'json', data: { name: 'logan', id: 'id' }, success: function(data, status) { if (typeof(data.error) != 'undefined') { if (data.error != '') { var dialog = art.dialog({ title: false, fixed: true, padding: 0 }); dialog.time(2).content("<div class='tips'>" + data.error + "</div>"); } else { var resp = data.msg; if (resp != '0000') { var dialog = art.dialog({ title: false, fixed: true, padding: 0 }); dialog.time(2).content("<div class='tips'>" + data.error + "</div>"); return false; } else { $('#' + hiddenid).val(data.imgurl); art.dialog.open("crop_image.php?img=" + data.imgurl, { title: '裁剪头像', width: '580px', height: '400px' }); //dialog.time(3).content("<div class='msg-all-succeed'>上传成功!</div>"); } } } }, error: function(data, status, e) { dialog.time(3).content("<div class='tips'>" + e + "</div>"); } }) return false; }