Store to S3 URL after Uploading File

Mark BakkerWorking with Filepicker, Working with Filestack0 Comments

Once a file is uploaded through Filestack there are several options for it. The most common case is to store it outside of Filestack’s servers – typically on an Amazon S3 account.

By default, the widget uses the pick() function. To store in S3 it has to be configured to use pickAndStore().

Once storing the file we’ll return a Blob which is a JSON object with the following properties:

  • key: The s3 key where we have stored the file
  • container: which is name of bucket where the file is stored

Then with the Filestack url you can get its S3 path by filepicker.stat function or REST metadata request.

Example:

/*InkBlob from a previous pick, etc.*/
var inkblob = { url: 'https://www.filestack.com/api/file/H7KYuWy1S3e1qvG2M66i' };
console.log("Loading metadata...");
filepicker.stat(inkblob, {path: true,container: true, location: true}, function(metadata){
    console.log(JSON.stringify(metadata));
});

Rest example :
https://www.filestack.com/api/file/hFHUCB3iTxyMzseuWOgG/metadata?container=true&path=true