File Handling

File Data Sources

When writing to the sys_file table, the extension introduces two virtual fields:

  • fileData: Base64-encoded file data.
  • url: A publicly accessible URL. The file data will be downloaded from this location or handled by an OnlineMediaHelper (such as for YouTube and Vimeo URLs, that are turned into .youtube and .vimeo files).

Base64-encoded file data

With the extension's default configuration, this example will create the file at fileadmin/tx_interest/image.png.

{
  "sys_file": {
    "ExampleRemoteId": {
      "fileData": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8...",
      "name": "image.png"
    }
  }
}
Copied!

The name field must be supplied and include a file extension.

Publicly accessible URL

Normal URL

The default behavior is that the file specified in the url field is downloaded to the download location specified in the persistence-fileuploadfolderpath UserTS configuration parameter.

With the extension's default configuration, this example will download the file at https://example.com/image.png to fileadmin/tx_interest/image.png.

{
  "sys_file": {
    "ExampleRemoteId": {
      "url": "https://example.com/image.png",
      "name": "image.png"
    }
  }
}
Copied!

The name field must be supplied and include a file extension.

URL with OnlineMediaHelper

If an OnlineMediaHelper is registered for the URL, it will take priority over any other file handling.

With the extension's default configuration, this example will create the file fileadmin/tx_interest/TYPO3_-_Channel_Intro.youtube.

{
  "sys_file": {
    "ExampleRemoteId": {
      "url": "https://youtu.be/zpOVYePk6mM",
    }
  }
}
Copied!

If the name field is used, the file will use the name supplied there and the correct extension added if necessary (e.g. .youtube).

File name sanitation

File names are sanitized using TYPO3's standard sanitation methods, so expect spaces to be replaced with underscores, etc.