利用ajax实现文件上传,在此记录
$.ajaxFileUpload({url:"<%=path%>/myshowwork/uploadAudio.jspa", secureuri:false, fileElementId:"audioFile", //页面中File标记 id的值 dataType:"json", success:function (data, status) { alert(decodeURIComponent(data));//服务器端汉字编码过,在这解码 window.location.href = "<%=path%>/myshowwork/myshow.jspa"; }, error:function (data, status, e) { alert("上传失败"); } });
用了ajaxfileupload.js文件,见附件