c# - asp.NET controller does not seem to be executing in proper order -
i using jquery file upload plugin , posting zip files controller. happening execution order cannot seem figure out. when set debug point @ top seems jump on place in controller , because of this, code not seem working think should.
here post:
$('#fileupload').fileupload({ url: '/fileupload/import', add: function (e, data) { var filesubmit = data.submit() .success(function (result, textstatus, filesubmit) { var name = data.files[0].name; filevalidation(name, textstatus); }) .error(function (filesubmit, textstatus, errorthrown) { var name = data.files[0].name; filevalidation(name, textstatus); }); }, done: function (e, data) { $.each(data.files, function(index, value){ if (value.name == "") { alert("error uploading: " + value.name + ". " + failstatus); } else { $('#filesubmit').show(); } }); } });
which seems firing off think would. post 1 file @ time shown here fiddler:
asp.net controller not seem executing in proper order , instead bounces on place. here controller:
[httppost] public actionresult import() { list<zipcontents> filelist = new list<zipcontents>(); var r = "file uploaded."; try { if (session["session_import_storage"] != null) { filelist = (list<zipcontents>)session["session_import_storage"]; } stream s = request.files[0].inputstream; string fn = request.files[0].filename; filelist.add(new zipcontents(s, fn)); session["session_import_storage"] = filelist; } catch { r = "an error occurred uploading file(s)."; } return json(r); }
what mean if set debug point at:
list<zipcontents> filelist = new list<zipcontents>();
and hover over: string fn = request.files[0].filename;
says: "morexmlfiles.zip"
then hit f11 , moves next line. , again steps try
. , again hits if statement
.
if hit f11 again goes way original debug point , when hover on string fn = request.files[0].filename;
again shows next file name already. code didn't finish first file...
does know going on here?! appreciated. thanks!
Comments
Post a Comment