Testing file and image upload API endpoints from the terminal is performed using cURL with the -F (--form) flag for multipart/form-data requests.
cURL File Upload Commands
# Upload image using multipart/form-data with @ prefix
curl -F "image=@/home/user/photo.jpg" -F "title=Sample Image" https://example.com/api/upload/
# Upload raw binary file with custom Content-Type header
curl -X POST -H "Content-Type: application/octet-stream" --data-binary "@/path/to/data.bin" https://example.com/api/binary/
Comments and corrections