Got response "We received a malformed request from your client" when try to upload image with github api #176875
Replies: 3 comments
-
I think the endpoint will be ok, becouse some app like https://github.com/XPoet/picx (upload image to github) is still working. |
Beta Was this translation helpful? Give feedback.
-
Find that only image size < 40k can be upload by API!!!, is there other way to upload larger thar 40k? |
Beta Was this translation helpful? Give feedback.
-
The Problem: Missing Content-Type Header The Solution: Add the Content-Type Header Secondary Check: File Size The GitHub API accepts files up to 100 MB, but since the file contents must be Base64-encoded, the actual size of your image file should be kept below ≈75 MB (as Base64 adds about 33% overhead). Thank you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
When I try to upload an image file via the https://docs.github.com/zh/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents interface, I get an error:
But upload a normal text file is OK.
Is GitHub API not allowed to upload files?
Here's my code:
Beta Was this translation helpful? Give feedback.
All reactions