3.f"/> 3.f">

Home  >  Article  >  Web Front-end  >  Detailed explanation of problems that occur when uploading ajaxfileupload

Detailed explanation of problems that occur when uploading ajaxfileupload

零下一度
零下一度Original
2017-07-20 14:28:131545browse

1. The following problems will occur when uploading ajaxfileupload:

2. There are many solutions on the Internet. Here, I found another one, maybe your error will be caused by this reason

------The reason is: You do not need to return to the foreground in the general handler Data format string

3. An example is given below:

  前台: 
  <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;} 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?1.1.11" type="text/javascript"></script> 9 <script src="../../Plugins/ajaxfileupload.js?1.1.11" 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         }); 
  </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("返回文本数据,否则前台就会报如上错误");

The above is the detailed content of Detailed explanation of problems that occur when uploading ajaxfileupload. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn