This is exactly what I was after. You're a life saver. I had a few false starts from other people's coding examples which seemed far more complicated. I intend to extend the code to have an image display after the upload instead of the drag and and drop area. I think the image data can still come back with the fileBundle (if I stringify a blob, but I might as well make a separate call). I see it would be easy to adapt the code to allow loading multiple documents, which is just a matter of looping through the files array appending more files to the form data and modifying the controller to parse that array. I will also thank you, as from a rudimentary glance, you appear to be using vanilla javascript and not jquery. Once I have the code integrated I would like to send you a small monetary reward if there is a way. I'll let you know how I go. If you're interested in the updated code, let me know, but I think any Dev could make the mods I intend to make.
Done! It works really great with multiple files now. I dispensed with the notion of a custom filename (I've never seen that requirement before) and just send the files and use their filenames. The controller was changed to loop over an array of fileBundle.PostedFile (which now returns an array of IFormFile) which I reference by index to send to SaveAs(renamed Save). As for displaying the image, that's a blobby story for another day.
This is exactly what I was after. You're a life saver.
I had a few false starts from other people's coding examples which seemed far more complicated.
I intend to extend the code to have an image display after the upload instead of the drag and and drop area.
I think the image data can still come back with the fileBundle (if I stringify a blob, but I might as well make a separate call).
I see it would be easy to adapt the code to allow loading multiple documents, which is just a matter of looping through the files array appending more files to the form data and modifying the controller to parse that array.
I will also thank you, as from a rudimentary glance, you appear to be using vanilla javascript and not jquery.
Once I have the code integrated I would like to send you a small monetary reward if there is a way. I'll let you know how I go.
If you're interested in the updated code, let me know, but I think any Dev could make the mods I intend to make.
Done! It works really great with multiple files now. I dispensed with the notion of a custom filename (I've never seen that requirement before) and just send the files and use their filenames. The controller was changed to loop over an array of fileBundle.PostedFile (which now returns an array of IFormFile) which I reference by index to send to SaveAs(renamed Save). As for displaying the image, that's a blobby story for another day.
Thanks man