Setting correct content type for images


I’ve uploaded several SVGs into the service,
however when getting them - for example;

wget --server-response

content type is set wrong;
Content-Type: application/octet-stream

I’m unable to modify this when uploading files.

wrong content type prohibits the use of these svgs in html…

Any solution?


Hi @eyal,

How did you upload this file? I have downloaded and re-uploaded it via the widget, and I can see its content-type is image/svg+xml.


I used the upload API, directly via curl and indirectly using the pyuploadcare


@eyal Thanks for the details. I need some time to check things and find out why this happens. Will be in touch soon.


@eyal for uploaded files, we set content type provided by the client you use for uploading. If no content type provided, we set the default content type - application/octet-stream

If you’re using pyuploadcare for uploads, you can specify content type when open a file and then pass it to the File.upload() method. It takes a file in the same way as requests so you can specify content type like this:

file = {'file': ('img.svg', open('img.svg', 'rb'), 'image/svg+xml')}

In case of using CURL, you can specify content type along with the file name:

curl -F "UPLOADCARE_PUB_KEY=demopublickey" -F "UPLOADCARE_STORE=1" -F "file=@img.svg;type=image/svg+xml" ""

Hope that helps.


Perfect, thanks for your help @achernenko.
That’s what I was missing.
I suggest you add this to the docs, since this bit pushed back the integration with you and made us switch to another service…


@eyal I’m sorry the lack of information on that matter caused difficulties with your integration. We’ll take this into account and will reflect this in our docs and help articles.