Photo upload always fails
I am about to hit my head against the keyboard - as per video attached my photo upload onto my ASP.NET app always fails.
The culprit seems to be the files in this code
`
Could anyone kindly point me in the right direction as to why files always go null in this code?
For the full contect here is my code https://paste.mod.gg/azthzgzpckja/0
BlazeBin - azthzgzpckja
A tool for sharing your source code with the world!
27 Replies
Is this ASP.NET Core? Which version?
Also, check the network panel in devtools to see what the request looks like
i think the problem is not creating the image,it's the showing them. Maybe you should check the correct url when passing it to img. for instance if you are working in local check for http://localhost.../imagePath/image.jpg
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
The request is 200 so seems to me like the frontend is able to communicate the event where the file picker picks up the image. However I have no idea why the files variable returns null on the controll side. Do you have any?
Been a hot while since I used jQuery
If the request goes through, works, and returns
200 OK
, no idea why the error
callback would triggerMy Rider suggested it
I'll check my devtool tomorrow.
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
BlazeBin - jnzbemvszqlh
A tool for sharing your source code with the world!
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
how ultra wrong
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Yes as you expected
[System.Web.Mvc.HttpPost] for example this notation is suggested Rider's AI (and a kind of autocorrected)
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
I have no clue for that either haha
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
seriously, I rarely touched .csproj
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Like 6 months ago or so I only manually added EFCore in there. Otherwise I never touched Compile Remove or Folder Include
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
sand in the oil tank .. awwwwww it sounds so bad
So this "ultra bad" csproj has something to do with my code's symptoms (not uploading/not displaying image on View)?
I checked the webtool just now and it still returns 200 - still, my controller has the null files variable
Maybe it has something to do with the wrong url when passing it to img like @Batuhan suggested

Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
Out of curiosity, what if you used plain JS and
fetch()
instead of jQuery?
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
Thank you so much for all this, I truly appreciate it ^^ I am very very new to js also so I will play around and experiment. If I have more questions I will reply here
Thank you so much for the functional example of csproj ^^ My reason for sticking with the old 7.0 is my Google search - perhaps I am abysmal at it too, it gives me deprecated information using even Net4 etc haha. And I am not technically versed enough to handle the latest version 9* etc
What do you think 9.x is, that you would not be technically versed enough to handle it?
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View