I'm from a web forms background and learning angular with web API in C# and I have working site for adding/editing and deleting an object record. I know want to move on to more complex problems but struggling to know where to start!
The nearest I've found is this post which seems quite good but limited to images but struggling to follow as its a bit confusing knowing which responses work. AngularJS .Net WebAPI Upload image and save to database (MSSQL).
What I would like to do very simply is have an Object with properties Name (string) and Logo (Logo stored in db binary field). From and angular view save the object (calling route of my Web API) including validating the name and saving an image and if it already has one, display the current image.
If anyone knows of a good simple example that will achieve that and ideally will work for any kind of file as some uploads in my site might be PDFs for example I would be hugely grateful.
I've used ng-file-upload in quite a few Angular projects with no problems. It has comprehensive documentation and many examples to get you started.
The have recipes for the server side stuff too, here is one for .NET
This answer will help on the controller side in terms of getting the uploaded files into a byte array that you can then insert into the database of your choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With