1.ajaxfileupload 上傳時(shí)會(huì)出現(xiàn)如下問題:
2. 網(wǎng)上有很多的解決辦法,在這里,我又發(fā)現(xiàn)了一種,可能你的錯(cuò)誤會(huì)是這個(gè)原因引起的
------原因是 : 你在一般處理程序中沒有返回前臺需要的數(shù)據(jù)格式字符串
3.下面給出一個(gè)例子:
前臺:
<style type="text/css"> .fileLink{position: relative;display: inline-block;background: #fff;border: 1px solid #0980D0;border-radius: 4px;padding: 2px 8px;margin-left:10px;margin-top:10px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;} .fileLink input {position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;} .fileLink:hover {background: #AADFFD;border-color: #78C3F3;cursor:pointer;color: #004974;text-decoration: none;} </style><span class="fL fileLink" style="padding-left: 10px;">選擇文件<input type="file" id="uploadify" name="uploadify" value="上傳數(shù)據(jù)" /></span><script src="../../Plugins/jquery/jquery-1.7.2.min.js" type="text/javascript"></script><script src="../../Plugins/ajaxfileupload.js" type="text/javascript"></script><script> $("#uploadify").on("change", function () { //var file = $("#uploadify")[0].files[0]; $.ajaxFileUpload({ url: './ImportDynamic.ashx', fileElementId: 'uploadify', dataType: 'text', success: function (data, status) { alert(1); }, error: function () { } }); });</script>一般處理程序: context.Response.ContentType = "text/plain"; var filePath = "uploadfile/xxx.xls"; filePath = context.Server.MapPath(filePath); Import.GetCommonReportFile(filePath); //context.Response.Write("返回文本數(shù)據(jù),否則前臺就會(huì)報(bào)如上錯(cuò)誤");
4.插件:http://files.cnblogs.com/files/namedL/ajaxfileupload.js
以上所述是小編給大家介紹的解決AjaxFileupload 上傳時(shí)會(huì)出現(xiàn)連接重置的問題,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對VeVb武林網(wǎng)網(wǎng)站的支持!
|
新聞熱點(diǎn)
疑難解答
圖片精選