发送Excel文件的ASP.NET Web API [英] Send Excel File to ASP.NET Web API
问题描述
我如何发送一个Excel文件,从文件上传来投入到我的ASP.NET的WebAPI,然后保存excel文件,所以我可以读取其数据?
How do I send an excel file coming from file upload input to my ASP.NET WebAPI and then save that excel file so I can read its data?
下面是我得到了什么(按一下按钮调用上传()) - 只是基础知识,工作正常:
Here's what I've got (button click calls upload()) - just the basics, which works fine:
function upload() {
$.getJSON("api/uploads/uploadfile",
function (data) {
$("#mydiv").append("Success: " + data.Success + " Failed: " + data.Failed);
});
}
和我的ASP.NET的WebAPI方式:
And my ASP.NET WebAPI method:
public DBResult UploadFile()
{
DBResult result = new DBResult();
result.Success = 0;
result.Failed = 0;
return result;
}
任何帮助是极大AP preciated。
Any help is greatly appreciated.
TIA
推荐答案
我能够将这些物品2之间摸不着头脑:
I was able to figure this out between these 2 articles:
<一个href=\"http://stackoverflow.com/questions/10320232/how-to-accept-a-file-post-asp-net-mvc-4-webapi/10327789#10327789\">How接受文件POST - ASP.Net MVC 4的WebAPI
<一个href=\"http://www.strathweb.com/2012/04/html5-drag-and-drop-asynchronous-multi-file-upload-with-asp-net-webapi/\" rel=\"nofollow\">http://www.strathweb.com/2012/04/html5-drag-and-drop-asynchronous-multi-file-upload-with-asp-net-webapi/
这篇关于发送Excel文件的ASP.NET Web API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!