question

Cycler-9545 avatar image
0 Votes"
Cycler-9545 asked RenaNi-MSFT commented

asp.net core 5 how to get .gif from input file using XmlHttpRequest()

Hi, guys!
Could anyone help me with this issue? I am still having trouble when IFormFile is always null. Thank you.

dotnet-csharpdotnet-aspnet-core-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Paul-5034 avatar image
1 Vote"
Paul-5034 answered Paul-5034 edited

It seems to work for me - this is from my view:
https://pastebin.com/raw/t2gqs0PR

(had to use PB because including it here caused the request to be blocked)

Here's from the HomeController:

[HttpPost]
public IActionResult Upload(IFormFile file) {        
    return Content("done");
}


Here's a breakpoint in that method:

141038-image.png

This is a fresh sample ASP.NET Core MVC project - is this roughly what your code looks like?




image.png (40.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Cycler-9545 avatar image
0 Votes"
Cycler-9545 answered RenaNi-MSFT commented

Thank you. But now my file uploads locally but nothing performs on hosting...

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do you get an errors, or does it just fail to bind? Also if you open the Developer Tools in the browser are you seeing any console errors?

0 Votes 0 ·

Hi @Cycler-9545 , where did you host? Could you please share more code and configurations?

0 Votes 0 ·