# Location Types

There are 4 types of locations Treasury can store files in:

  • Local
  • Amazon S3
  • SFTP
  • FTP

These are fairly self explanatory and do just what you would expect. Each type will have slightly different settings.

# Common Location Settings

There are four settings that are common to each location:

Name (required)

This is the friendly name of the location and can be anything you want.

Handle (required)

This is the programatic name for your location. It must be Alpha Dash (alpha plus dashes and underscores).

Allowed File Types (required)

This lets you determine whether the location should accept all file types or just images.

Type (required)

The type switcher determines which of the four types this location is. The options are Local, Amazon S3, SFTP, and FTP. As you select from the four different types, the available settings fields will update accordingly.

# Local Location Settings

Location URL (required)

This should be the full URL used to get to the location.

Location Path (required)

This should be the full server path to the location on disk.

# Amazon S3 Location Settings

Access Key ID (required)

The Access Key ID from your bucket’s generated credentials.

Secret Access Key (required)

The Secret Access Key from your bucket’s generated credentials.

Bucket Region (required)

Select the region your bucket is in.

Bucket (required)

The name of your bucket.

Subfolder

Optionally specify a subfolder you would like to use on the specified bucket.

Location URL (required)

The bucket’s URL (do not include sub-folders).If you set up a CNAME for the bucket use it here. Otherwise use the format http://s3.amazonaws.com/mybucketname or http://s3-eu-west-1.amazonaws.com/mybucketname (etc. depending on the bucket region).

# SFTP Location Settings

Server (required)

The IP address or domain name of the SFTP server your files will be uploaded to.

Username (required)

The username to log in to the SFTP server.

Password

If you are logging in with a password, enter it here. If you are logging in with a private key, and the key requires a password, enter it here. Otherwise this can be left blank.

Private Key

You can paste a private key in here.

Private Key Path

To use a private key on your server, specify the full server path here. This overrides the Private Key setting.

Use Config Private Key Path

If you have specified a private key path in your config file (see below), this option is available. When set to yes, this overrides the two key settings above.

Port (required)

If your SFTP server uses a custom port, enter it here. Otherwise use the default port 22.

Remote Path

Set the remote server path for your upload location.

Location URL (required)

This should be the full URL used to get to the location.

# FTP Location Settings

Server (required)

The IP address or domain name of the SFTP server your files will be uploaded to.

Username (required)

The username to log in to the SFTP server.

Password

If you are logging in with a password, enter it here.

Port (required)

If your SFTP server uses a custom port, enter it here. Otherwise use the default port 22.

Remote Path

Set the remote server path for your upload location.

Location URL (required)

This should be the full URL used to get to the location.

# File Config

Treasury locations can also be controlled in your ExpressionEngine config file (version control ALL THE THINGS!).

Here is what the config looks like:

Example
												
$config['treasury'] = array(
	'private_key_path' => '/var/user/.ssh/id_rsa',
	'locations' => array(
		// Location handle
		'bzpxl-test-bucket' => array(
			'name' => 'My Location', // Common to all location types
			'type' => 'amazon_s3', // local|amazon_s3|sftp|ftp
			'allowed_file_types'=> 'images_only', // images_only|all_file_types
			'url' => 'https://s3.amazonaws.com/mybucket/', // Location URL common to all locations types
			'path' => '', // Path on disk for local type only
			'access_key_id' => '******', // Amazon S3,
			'secret_access_key' => '******', // Amazon S3
			'bucket_region' => 'us-east-1', // Amazon S3 - must match a bucket region value for Amazon S3
			'subfolder' => 'mysubdirectory', // Amazon S3
			'server' => '', // Common to SFTP and FTP
			'username' => '', // Common to SFTP and FTP
			'password' => '', // Common to SFTP and FTP
			'private_key' => '', // SFTP
			'private_key_path' => '', // SFTP
			'use_config_private_key_path' => true, // SFTP
			'port' => '22', // Common to SFTP and FTP
			'remote_path' => '' // Common to SFTP and FTP
		)
	)
);