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:
and then I have this in my controller:
- public ActionResult Admin(string submitNew)
- {
- uploadFileToSqlDb();
- return View();
- }
The above calls my function. Here is the function:
- [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.