cURL Cheat Sheet/Upload a file with explicit content type

Specify the filename part and content type.

Section: Forms and Upload

Upload a file with explicit content type

bash
bash
curl -F 'file=@./image.png;type=image/png' https://example.com/upload
Explanation

Handy when the server expects a precise MIME type.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Forms and Upload
Upload a file via multipart form
Attach a file as a multipart upload.
OpenIn sheetbashsame section
Submit a multipart form field
Send a simple form field using multipart/form-data.
OpenIn sheetbashsame section
Upload a file with PUT
Send a local file as the request body with PUT.
OpenIn sheetbashsame section
Send binary request data
Send binary-safe request data without transformations.
OpenIn sheetbashsame section
Send raw request data
POST a raw string body exactly as provided.
OpenIn sheetbashsame section
URL-encode request data
Encode form or query values safely.
OpenIn sheetbashsame section