I'm trying to use an Upload component on a .Net Core 2.2 Razor Pages project, I have a form to edit a record, where I would like to add a file as a an attachment.
I've been trying 2 difference methods to achieve this.
Method 1 - To a Controller
I've been able to get the below to upload a file to a controller, where I can convert to a byte array to eventually try and save to a database.
Problem: I don't know how pass the records ID when the files are passed to the controller, so I can save the Byte Array to the correct record. How do I include a parameter?
Method 2 - Via Code Behind (Ideal)
The ideal method as this is a razor pages app, is to pass the files to a handler on the code behind, so I have the Record ID available, I've moved the SaveAsync Task to the Razor page code behind, but I can't get it to trigger when the file is uploaded.
So far, I've tried the below to call the OnPostSaveAsync Handler
Problem: It doesn't trigger the handler.. Can you see what I'm missing/done wrong? If passing the razor code behind isn't possible, how would I pass a parameter of the record ID to the controller, using the MVC method?
Thanks in advance for any help on this, we've only recently purchased DevCraft and I'm hoping it's something simple!