How to use a presigned URL to upload a file?

I don't know how to properly use the presigned URLs.

First, I get the presigned URL:

$ curl -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" -X POST -d '{ "method": "PUT", "name": "buff.png", "content_type": "image/png" }' 'https://api.linode.com/v4/object-storage/buckets/us-southeast-1/characters/object-url'
{"url": "{url is here}", "exists": false}

Then, I attempt using it to upload a file, but I get an "InvalidArgument" error. (Why is the error not more informative? What argument is invalid?)

$ curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: image/png" -X PUT -T '/home/sensei/pictures/buff.png' "$url" 
<?xml version="1.0" encoding="UTF-8"?><Error><Code>InvalidArgument</Code><RequestId>tx000007a1a1df328e20860-0063dfa294-9c5fb11-default</RequestId><HostId>9c5fb11-default-default</HostId></Error> 

What am I doing wrong?

1 Reply

Update: This is the correct format:

curl -X PUT -H "Content-Type: image/png" -T ~/pictures/buff.png $presignedurl

Make sure not to include any Authorization header.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct