Uploading Files

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

Uploading a File

User Console

Files can be uploaded directly from the User Console.

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

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

  3. Click Upload.

    https://console.soracom.io

    Upload

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

    Dialog Box

  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

curl -X PUT \
>  -H "Content-Type: text/plain" \
>  --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:

curl -X PUT \
>  -H "Content-Type: text/plain" \
>  --data-binary @a.png \
>  http://harvest-files.soracom.io/

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

Please 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. Please 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:

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:

curl -X PUT \
>  -H "Content-Type: text/plain" \
>  --data-binary @a.png \
>  http://harvest-files.soracom.io/

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