New to Telerik UI for Blazor? Download free 30-day trial

Upload Troubleshooting

The Upload component requires integration with remote endpoints and controller methods to work. Controller routing depends entirely on the app configuration. This article discusses the most common pitfalls.

Action Method Argument null

The action method is hit, but the method argument is null

  • Make sure the action method argument names match the SaveField and RemoveField values. The default value of both parameters is "files".
  • The argument type of the SaveUrl action method should be IFormFile or IEnumerable<IFormFile>.
  • The argument type of the RemoveUrl action method should be string or IEnumerable<string>.
  • The uploaded file size may be over the web server's maximum.

HTTP 400 Bad request

The action method is not hit and the server returns HTTP 400 Bad request.

HTTP 415 Unsupported Media Type

The Remove action may return HTTP 415 Unsupported Media Type.

This means that the Remove action method expects IEnumerable<string> and .NET does not infer the correct binding source. Set a [FromForm] binding source attribute to the file name argument.

Connection Error and No Response

The server does not return any response. The browser console shows connection errors like:

  • Failed to load resource: net::ERR_CONNECTION_RESET
  • Failed to load resource: The network connection was lost.

This means that the uploaded file size exceeds the web server's maximum.

Antiforgery Validation Blocks the Upload Requests

If the upload controller is decorated with the [ValidateAntiForgeryToken] attribute, the Upload component must include antiforgery tokens in its upload and delete requests. Use the OnUpload and OnRemove events to add the required antiforgery tokens.

See Also

In this article