# Uploading Files

Upload files to Harvest Files from devices or via the User Console.

Files can be uploaded to Harvest Files via the User Console, by configuring your Air for Cellular device to send them to Harvest Files' HTTP entry point, or via the Soracom API.

## Uploading a File

### User Console

Files can be uploaded directly from the [User Console](https://console.soracom.io/).

1. From the User Console, click the **☰ Menu** button.

2. Click **Soracom Harvest Files** from the Data Storage & Visualization section.

3. Click **Upload**.

   ![Upload](https://docs.soracom.io/_astro/upload.D1N6Ql5M_Z1ctzci.webp)

4. Drag your file into the dialog box or click **browse** to select a file using your file browser.

   ![Dialog Box](https://docs.soracom.io/_astro/dialog.BIz-GPxD_Zo466X.webp)

5. Click **Upload** to upload your file. Files will appear in the list after the page has been refreshed.

### Entry Point

The Harvest Files HTTP entry point accepts PUT requests from an Air for Cellular device.

Your device should be configured to send data to: `http://harvest-files.soracom.io`, appending any file path and filename to the request URL in order to specify where you would like the file to be saved within Harvest Files.

### Example

```bash
curl -X PUT \
  -H "Content-Type: image/png" \
  --data-binary @a.png \
  http://harvest-files.soracom.io/images/a.png
```

## Default Path

Harvest Files provides an option for setting the default path where files should be saved. This allows you to simplify the file naming logic on the device and instead control it in Harvest Files settings, or to implement more sophisticated file management mechanisms.

### Setting a Default Path

By setting a default path in Harvest Files settings, a device that uploads a file to Harvest Files does not need to specify a file path or filename in the HTTP PUT request URL.

For example, if the **Default Path** option is set to `/images/latest.png`, then when a device uploads a file using just the Harvest Files entry point as below:

```bash
curl -X PUT \
  -H "Content-Type: image/png" \
  --data-binary @a.png \
  http://harvest-files.soracom.io/
```

The file will automatically be saved to the `/images/latest.png` file path.

> [!NOTE]
>
> Note that the **Default Path** option is a _file path_ and cannot be used to specify a _directory_. If the **Default Path** option is set to a value such as `/images/`, the trailing slash `/` will be ignored, and any uploaded file will be saved to the `/images` file path. Be aware of this behavior, as Harvest Files will automatically overwrite any existing file.

However, even with the **Default Path** option set, it can always be overridden by the device by specifying a file path as part of the PUT request URL.

### Using Path Variables

The **Default Path** setting also supports the following placeholder variables:

- `:imsi` - The IMSI of the subscriber that uploaded the file
- `:time` - The Unix timestamp when the file was uploaded

For example, if the **Default Path** option is set to `/images/:imsi/:time`, then when a device uploads a file using just the Harvest Files entry point as below:

```bash
curl -X PUT \
  -H "Content-Type: image/png" \
  --data-binary @a.png \
  http://harvest-files.soracom.io/
```

The file will be automatically saved to the `/images/295000012345678/1561780299935` file path.
