C
C#14mo ago
khauvannam

❔ I want to create post which contain image and still stuck in this shit 3 days, help me :((

I have tested in postman but it always return 415 error
No description
No description
No description
No description
No description
No description
18 Replies
substitute
substitute14mo ago
Your postman request is sending Content while you expect PostContent That's the only thing that immediately stands out.
khauvannam
khauvannamOP14mo ago
Im in the road so when i go home, i will check it again, thanks u
substitute
substitute14mo ago
also postman is using this URI
substitute
substitute14mo ago
No description
substitute
substitute14mo ago
No description
substitute
substitute14mo ago
the only route I see that accepts POST is on / but it's a little hard to tell with the collection of screenshots
khauvannam
khauvannamOP14mo ago
i forgot to screenshot the mapgroup
No description
khauvannam
khauvannamOP14mo ago
it still return that shitting error :(((
No description
khauvannam
khauvannamOP14mo ago
can i give you my github project link so you can fork it and help me :((
substitute
substitute14mo ago
like 95% of what I work on is C++. I only use C# when it's a requirement.
khauvannam
khauvannamOP14mo ago
i still learning but this is first time i can not fix the error when i try so hard to search in everything
khauvannam
khauvannamOP14mo ago
https://github.com/khauvannam/BlogProject.Server.git if you see any error, please help me fix it ;((
GitHub
GitHub - khauvannam/BlogProject.Server
Contribute to khauvannam/BlogProject.Server development by creating an account on GitHub.
Omnissiah
Omnissiah14mo ago
don't commit your bin folder there's a bunch of stuff that is unclear to me why are you not sending a body, it would be the post content also what is the content type of this post? html?
khauvannam
khauvannamOP14mo ago
I think i sending the body So what should i do next? Sorry i am still a newbie, so what should i do next? Just ignore bin/** and obj folder
Omnissiah
Omnissiah14mo ago
ok but you understand it shouldn't be there in the first place it makes downloading the project from 30 KB to like 8 MB it's like 300x the size i would ask you describe what the CreatePost api should do send the post? send post + attachments? and in which format: multipart, json... are there requirements or are you building it from scratch
khauvannam
khauvannamOP14mo ago
Send the post + attachment, the attachment will be store in my azure blob Then respone the content, id, and the url of my blob file Multipart form, it will return an json which i can use for my frontend I build it from scratch
Omnissiah
Omnissiah14mo ago
[hopefully i can sand messages now] using multipart would be more involved if you search how to read multipart from c# you'll find articles even from microsoft https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/sending-html-form-data-part-2
Sending HTML Form Data in ASP.NET Web API: File Upload and Multipar...
This tutorial shows how to upload files to a web API. It also describes how to process multipart MIME data.
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server