(ajaxfileupload)ajaxfileupload 上傳時會出現串連重設的問題

來源:互聯網
上載者:User

標籤:position   named   imp   jquery   問題   hidden   function   context   com   

1.ajaxfileupload 上傳時會出現如下問題:

 

2. 網上有很多的解決辦法,在這裡,我又發現了一種,可能你的錯誤會是這個原因引起的

------原因是 : 你在一般處理常式中沒有返回前台需要的資料格式字串

 

3.下面給出一個例子:

 

 1 前台:  2 <style type="text/css"> 3         .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;} 4         .fileLink input {position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;} 5         .fileLink:hover {background: #AADFFD;border-color: #78C3F3;cursor:pointer;color: #004974;text-decoration: none;} 6     </style> 7 <span class="fL fileLink" style="padding-left: 10px;">選擇檔案<input type="file" id="uploadify" name="uploadify" value="上傳資料" /></span> 8 <script src="../../Plugins/jquery/jquery-1.7.2.min.js" type="text/javascript"></script> 9 <script src="../../Plugins/ajaxfileupload.js" type="text/javascript"></script>10 11 <script>12        $("#uploadify").on("change", function () {13             //var file = $("#uploadify")[0].files[0];14             $.ajaxFileUpload({15                 url: ‘./ImportDynamic.ashx‘,16                 fileElementId: ‘uploadify‘,17                 dataType: ‘text‘,18                 success: function (data, status) {19                     alert(1);20                 },21                 error: function () { }22             });23         });24 </script>25  26 一般處理常式:27             context.Response.ContentType = "text/plain";28             var filePath = "uploadfile/xxx.xls";29             filePath = context.Server.MapPath(filePath);30             Import.GetCommonReportFile(filePath);31             //context.Response.Write("返迴文本資料,否則前台就會報如上錯誤");

 

4.外掛程式:http://files.cnblogs.com/files/namedL/ajaxfileupload.js

 

(ajaxfileupload)ajaxfileupload 上傳時會出現串連重設的問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.