This is a migrated thread and some comments may be shown as answers.

Http Error 415 when trying to remove an uploaded file

2 Answers 356 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Mark Stevens
Top achievements
Rank 1
Mark Stevens asked on 02 Apr 2020, 07:18 PM

I get the following error when attempting to remove an uploaded file. I'm using the example code from the Upload Overview Document https://docs.telerik.com/blazor-ui/components/upload/overview?_ga=2.20672573.407168315.1585784320-1941347284.1557871324

 

VS 2019 Output Window.

Failed to load resource: the server responded with a status of 415 () [https://localhost:44326/api/upload/remove]

Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint 'TestUpload.Controllers.UploadController.Remove (TestUpload)'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 69.8482ms 415 application/problem+json; charset=utf-8

 

Browser Console.

telerik-blazor.js:39 POST https://localhost:44326/api/upload/remove 415
value @ telerik-blazor.js:39
value @ telerik-blazor.js:39
value @ telerik-blazor.js:39
value @ telerik-blazor.js:39
value @ telerik-blazor.js:39
u @ telerik-blazor.js:1
(anonymous) @ blazor.server.js:8
beginInvokeJSFromDotNet @ blazor.server.js:8
(anonymous) @ blazor.server.js:1
e.invokeClientMethod @ blazor.server.js:1
e.processIncomingData @ blazor.server.js:1
connection.onreceive @ blazor.server.js:1
i.onmessage @ blazor.server.js:1

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Mark Stevens
Top achievements
Rank 1
answered on 02 Apr 2020, 08:48 PM

I added the [FromForm] attribute to the Remove method of the API and it's working now.

 

     public ActionResult Remove([FromForm] string[] files)

0
Marin Bratanov
Telerik team
answered on 03 Apr 2020, 08:01 AM

Thank you for sharing your solution with the community, Mark. I have marked it as the answer to this thread.

It is a bit odd that the docs wouldn't work immediately, but there can be many specifics around the API endpoints an app can have and the Remove request is, ultimately, a form field in the POST query that contains a string.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Upload
Asked by
Mark Stevens
Top achievements
Rank 1
Answers by
Mark Stevens
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or