I’m trying to upload a file to a Note in shotgun using the REST Api. Here is my ajax call. However I keep getting an error. What is a signature? Why do i need this?
The error:
{“errors”:[{“id”:1,“status”:400,“code”:103,“title”:“Signature did not match”,“source”:{},“detail”:null,“meta”:null}]}
The Signature did not match error is not particular to Shotgun but rather to S3. Due to the way objects are stored and accessed from S3 by Shotgun given it’s security measures, I believe there is always a requirement of a pre-signed expiring url, whether downloading/displaying or uploading.
Please go through the file handling section of the docs to understand how to generate a pre-signed url and subsequently upload your file. Please note that any pre-signed url will expire after a set time and you will need to regenerate a pre-signed url everytime you initiate a new upload. (Except perhaps for multi-part upload)
How can I upload an image using multipart with javascript? That is what i need to do.
When i try to use the Multi-part upload. i get the Title Not Found error. But there is no argument required or showing that.
I noticed if the sample online it says for multipart to do the following. However i do not believe the ? is suppose to be in there.
data: '?filename=string&signatur...
It would be great if there was a full example of this using javascript to understand all the parts required. it says you need a user_id but how do i get that? I’m logging in using a secret and key.
@daigles I’ve been looking deeper into your github sample which has been quite helpful. The one thing I’m curious about is how do you determine the Content-Type dynamically? I see that in your sample you are hard coding jpg, but i would like to give user the ability to choose videos or images. So how can i make the type dynamic in that regard?
Specifying te content type will help browsers (and possibly other client apps) to know how to display the file (eg. show the file content or pop a “download” dialog).