For jquery1.11.1 ajaxfileupload. js, jquery1.11.1
Ajaxfileupload source code
Solve the problem that success is not taken after the upload is successful.
Solve compatibility problems of jquery in later versions
JQuery. extend ({
CreateUploadIframe: function (id, uri)
{
// Create frame
Var frameId = 'juploadframe '+ id;
Var iframeHtml = '<iframe id = "' + frameId + '" name = "' + frameId + '"> with html code and server code
<Input type = "file" id = "importFile" name = "importFile" accept = "text/plain" style = "display: none"/>
# Region Upload File Read imported content
Public JsonResult Upload ()
{
HttpFileCollectionBase HFCs = Request. Files;
String Path = "";
List <LgtdAndLttd> list = new List <LgtdAndLttd> ();
String PhysicalPath = "";
If (hfc-count> 0)
{
If (HFCs [0]. FileName. Contains ("\\"))
{
Int index = HFCs [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 );
HFCs [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