API to upload a media directly to a storage
To upload a file, send a PUT request to the signed URL you retrieved earlier. Include the file as the request body and specify the correct Content-type in the headers.
Example with using axios:
axios.put(signedUrl, fileBuffer, { headers: { 'Content-Type': mimetype } }).then(...).catch(...)
Example with using cURL:
curl -X PUT -H "Content-Type: mimetype" -T /path/to/file "signedUrl"
Note: Replace mimetype with the actual content type and file with the path to the file you want to upload.
Example for Python with requests module:
import requests
response = requests.put(signed_url, data=open(file, 'rb'), headers={'Content-Type': mimetype})
PUT and correct Content-type
You don't need to send a request with multipart/form-data in "Content-type" header or something else (like for a POST). Just specify a correct MIME type of uploading file and send file as is in request body.
And then trigger our API with included signed URL to confirm that a file has been uploaded successfully.