Good morning!
I was able to do this in asp.net but I am moving to MVC using C# and am stuck.
Here is my view:
- @using (Html.BeginForm())
- {
- @Html.AntiForgeryToken()
- "submitNew" value="submitNew" />
- }
and then I have this in my controller:
- public ActionResult Admin(string submitNew)
- {
- uploadFileToSqlDb();
- return View();
- }
- [HttpPost]
- public ActionResult uploadFileToSqlDb()
- {
- byte[] uploadedFile = new
- byte[Request.Files["bgFileUpload"].InputStream.Length];
- return View();
- }
But everytime I get a "Object reference not set to an instance of an object". Any suggestions for a noobie such as myself?
Everything I have seen online I appear to be doing incorrectly or possibly interpretting it wrong.
Sanwar RanwaPosted Aug 10, 2018, 10:56 AM
The GamerPosted Aug 10, 2018, 11:53 AM