Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
hello,
i want to upload excel file using Asp.net5 MVC6 and AngularJs


when i want to invoke my action the paramètre is null i want just send my excel file to action to upload it in my repository
plzz i need your help

What I have tried:

the code below in this url

http://www.mediafire.com/view/9cb0t300rtl0h17/code.txt
Posted

1 solution

I'm not going to go to an external site to look at your code, so I'm posting the generic solution.

Just use a normal form upload for your file.

C#
<form action="@Url.Action(" uploadaction="," uploadcontroller=")">
   <input type="file" />
   <input type="submit" value="Upload" />
</form>


Then in your controller:

C#
public ActionResult UploadAction(HttpPostedFileBase file)
{
   //Save file.InputStream to your repo
}


Information on the HttpPostedFileBase can be found at:
HttpPostedFileBase Class (System.Web)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900