HttpContext.Current.Request.Files[0].FileName returning blob for image files

时间:2016-10-20 18:40:51

标签: c# angularjs asp.net-web-api httpcontext ng-file-upload

I am sending a file as part of the FormData from AngularJs to .NET Web API as follows:

AngularJS:

var cabinetFormData = new FormData();
cabinetFormData.append('file', file);

Sending the above FormData as a parameter in the service call to .Net WebAPI

.NET:

var httpRequest = HttpContext.Current.Request;
var fileRequest = httpRequest.Files[0];

While receiving the request on the server side, the fileRequest.FileName is always showing up as "blob" for any image files. Rest of the content is showing up fine. Getting proper File names for other format's like .pdf and .xml. I have checked the input, and it's sending all the formData.

enter image description here

What am i doing wrong ?

1 个答案:

答案 0 :(得分:1)

I would post this as a comment, but I don't have the rep yet..

If you're using Firefox when you see this issue, these links might help you out:

Uploaded file comes in as blob if not on localhost? asp.net mvc4 using IIS express

https://groups.google.com/forum/#!topic/jquery-fileupload/RjfHLX2_EeM

:)