[Shell command] Upload a file with curl -F

Created on November 30, 2026

You can use curl -F to send a local file as a multipart form field. This example reads scores.txt from the current directory and sends it as the somefile field.

curl -F 'somefile=@scores.txt' https://example.com/upload

The @ tells curl to read the file from disk. The -F option sends a POST request with a multipart/form-data body. Replace the example URL with your upload endpoint and use the field name it expects.

Shell command