Azure Storage

Filestack can also be configured to store users' files directly into your Azure storage account. To do this click the Azure link in your developer portal under Storage.

You will need to specify the Azure storage account name, as well as the primary access key. Azure does not support rich access-based control mechanisms, so there is no need to configure a separate user for Filestack.

Azure Storage Installation

This video walks through the steps listed below

  1. Log into the Azure Dashboard and click on Storage. IMPORTANT: the Azure API has been updated. In order to create an Azure container that is compatible with Filestack, you must login to your account from this address https://manage.windowsazure.com.
  2. Click on storage in the side menu and then click on "Create a Storage Account" then in the pop up enter a url (account name), location, and select a replication setting and click create storage account.
  3. Click on the new storage container to go to the dashboard.
  4. Click containers and make a new container. The Access Type should be "Public Container". Copy the Container Name, you will need it later.
  5. Click back to the dashboard, and then click on Manage Access Keys in the bottom of the screen. Copy the Storage Account Name and Primary Access Key (you should already have the container name).
  6. Go to the Filestack Developer Portal and click on Azure. You need the Storage Account Name and Primary Access Key from the Manage Access Keys window in Azure. You also need the name of the container you created. Enter them all in the developer portal and save each field.
  7. Click the Test Azure Settings button to confirm successful configuration.
  8. Check the Azure container for a Filestack test file.

Azure is all set up. You may now enter 'azure' as a value for the location storage options parameter.

Storing to Azure Storage using the Javascript API

You can store your files to Storage with the client.pick Javascript API method.

client.pick({ storeTo: { location: 'azure', } }).then(result => { console.log(JSON.stringify(result.filesUploaded)) })

Azure Storage Options for Javascript API

storeTo
An optional dictionary of key-value pairs that specify how the picker stores files.
storeTo
Object
storeTo: { parameter: value }

Accepts an optional dictionary of key-value pairs that specify how the picker should store files once they are selected for upload.

Location
String
storeTo: { location: 'azure' }

Where to store the file. The default is s3. Other options are 'azure', 'dropbox', 'rackspace' and 'gcs'. You must have configured your storage in the developer portal to enable this feature. Note: Rackspace, Azure, Dropbox and Google Cloud are only available on the Grow and higher plans.

Path
String
storeTo: { path: '/myfiles/1234.png' }

The path to store the file at within the specified file store. For S3, this is the key where the file will be stored at. By default, Filestack stores the file at the root at a unique id, followed by an underscore, followed by the filename, for example "3AB239102DB_myphoto.png".

If the provided path ends in a '/', it will be treated as a folder, so if the provided path is "myfiles/" and the uploaded file is named "myphoto.png", the file will be stored at "myfiles/909DFAC9CB12_myphoto.png", for example.

IMPORTANT: If the maxFiles parameter is greater than one, be sure to only use paths that end in '/' or else all uploaded files will be written to the same object in your bucket. In other words, the files will overwrite each other.

Container
String
storeTo: { container: 'user-photos' }

The bucket or container in the specified file store where the file should end up. This is especially useful if you have different containers for testing and production and you want to use them both on the same Filestack app. If this parameter is omitted, the file is stored in the default container specified in your developer portal.

Note: This parameter does not apply to the Dropbox file store.

Region
String
storeTo: { region: 'us-east-1' }

The region where your storage container is located. This setting currently applies only to S3 buckets. If you are using a different bucket and region than the one you set up in your developer portal you can pass the region as part of your store options. If this parameter is not set we will do our best to determine the region your S3 bucket is located so that we can properly authenticate our connection request. You can find a list of the S3 regions here: in the "region" column.

Public Access
String
storeTo: { access: 'public' }

Indicates that the file should be stored in a way that allows public access going directly to the underlying file store. For instance, if the file is stored on S3, this will allow the S3 url to be used directly. This has no impact on the ability of users to read from the Filestack file URL. Defaults to 'private'.

Azure Storage Options for REST API

Similar to the client.storeURL call in javascript, you can use the Filestack files library to send files directly to your azure bucket and get back a Blob for further operations. To do this, issue a POST to the /api/store/azure endpoint, along with your apikey, the file, and an optional set of parameters.

Store local file to azure:
Request:
>>> curl -X POST -F fileUpload=@filename.txt https://www.filestackapi.com/api/store/azure?key=MY_API_KEY
Result:
{"url": "https://www.filestackapi.com/api/file/HLOon3NcTS6w7rqyZ3ei", "size": 234, "type": "text/plain", "filename": "tester.txt", "key": "1ilWxmaRRqhMd2vSbSyB_tester.txt"}
Store URL to azure
Request:
>>> curl -X POST -d url="https://d3urzlae3olibs.cloudfront.net/watermark.png" https://www.filestackapi.com/api/store/azure?key=MY_API_KEY
Request:
{"url": "https://www.filestackapi.com/api/file/s7tdGfE5RRKFUxwsZoYv", "size": 8331, "type": "image/png", "filename": "watermark.png", "key": "a1RyBxiglW92bS2SRmqM_watermark.png"}
Store URL to azure and set parameters
Request:
>>> curl  -X POST  -d  url="https://d3urzlae3olibs.cloudfront.net/watermark.png"  "https://www.filestackapi.com/api/store/azure?key=AhTgLagciQByzXpFGRI0Az&path=/myfiles/1234.png&mimetype=image/png"
Request:
{"container": "custom_source", "url": "https://www.filestackapi.com/api/file/rLNF34IvRWybiNIATg4D", "filename": "watermark.png", "key": "myfiles/1234.png", "type": "image/png", "size": 8331}

The REST Store parameter names are exactly the same as the Javascript ones.

If you set additional parameters make sure that the URL is given in quotes.

syntax
https://www.filestackapi.com/api/store/azure?key=MY_API_KEY&[options]

These parameters can be appended to your URL, after your API key with the & symbol and parameter_name=

Filename
String
filename=MyCoolPhoto.png

The name of the file as it will be stored. If this isn't provided, we do the best we can to come up with one.

Path
String
path=/myfiles/1234.png

The path to store the file at within the specified file store. For azure, this is the key where the file will be stored at. By default, Filestack stores the file at the root at a unique id, followed by an underscore, followed by the filename, for example "3AB239102DB_myphoto.png".

If the provided path ends in a '/', it will be treated as a folder, so if the provided path is "myfiles/" and the uploaded file is named "myphoto.png", the file will be stored at "myfiles/909DFAC9CB12_myphoto.png", for example.

If the multiple option is set to true, only paths that end in '/' are allowed.

Mimetype
String
mimetype=text/html

The type of the file as it will be stored. If this isn't provided, we do the best we can, defaulting to "text/plain" if you give us raw data.

Base64 Decoding
Boolean
base64decode=true

Specify that you want the data to be first decoded from base64 before being written to the file. For example, if you have base64 encoded image data, you can use this flag to first decode the data before writing the image file.

Store Container
String
container=user-photos

The bucket or container in the specified file store where the file should end up. This is especially useful if you have different containers for testing and production and you want to use them both on the same Filestack app. If this parameter is omitted, the file is stored in the default container specified in your developer portal.

Note: This parameter does not apply to the Dropbox file store.

Store Region
String
storeRegion=us-east-1

The region where your storage container is located. This setting currently applies only to S3 buckets. If you are using a different bucket and region than the one you set up in your developer portal you can pass the storeRegion as part of your store options. If this parameter is not set we will do our best to determine the region your S3 bucket is located so that we can properly authenticate our connection request. You can find a list of the S3 regions here: in the "region" column.

Public Access
String
access=public

Indicates that the file should be stored in a way that allows public access going directly to the underlying file store. For instance, if the file is stored on azure, this will allow the azure url to be used directly. This has no impact on the ability of users to read from the Filestack file URL. Defaults to 'private'.

Security
String
policy=POLICY&signature=SIGNATURE

If you have security enabled, you'll need to have a valid Filestack policy and signature in order to perform the requested call. This allows you to select who can and cannot perform certain actions on your site. Read more about security and how to generate policies and signatures