ajaxfileupload源码

解决上传成功不走success的问题

解决高版本jquery兼容性问题

jQuery.extend({


createUploadIframe: function(id, uri)
{
//create frame
var frameId = 'jUploadFrame' + id;
var iframeHtml = '<iframe ).html(data).evalScripts();

return data;
}
})

 

附html代码和服务端代码

 

 <input type="file" />

 

 

#region 上传文件 读取导入的内容
public JsonResult Upload()
{
HttpFileCollectionBase hfc = Request.Files;
string Path = "";
List<LgtdAndLttd> list = new List<LgtdAndLttd>();
string PhysicalPath = "";
if (hfc.Count > 0)
{
if (hfc[0].FileName.Contains("\\"))
{
int index = hfc[0].FileName.LastIndexOf('\\');
Path = "/Upload" +hfc[0].FileName.Substring(index, hfc[0].FileName.Length - index);
}
else
Path = "/Upload/" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff") + System.IO.Path.GetFileName(hfc[0].FileName);
PhysicalPath = Server.MapPath(Path);
hfc[0].SaveAs(PhysicalPath);
StreamReader sr = new StreamReader(PhysicalPath);
LgtdAndLttd sta = new LgtdAndLttd();
while(sr.Peek()>=0)
{
sta.LGTD = sr.ReadLine().Split('|')[0];
sta.LTTD = sr.ReadLine().Split('|')[1];
list.Add(sta);
}
}
return Json(list);
}
#endregion

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
  • 2021-08-27
  • 2021-12-31
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
相关资源
相似解决方案