Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: ref. EZP-26333

Table of Contents
minLevel2

This FieldType represents and handles a binary file. It also counts the number of times the file has been downloaded from the content/download module.

NameInternal nameExpected inputOutput
BinaryFileezbinaryfileMixedMixed

Table of contents:

Table of Contents
minLevel2

Description

...

This FieldType allows the storage and retrieval of a single file. It is capable of handling virtually any file type and is typically used for storing legacy document types such as PDF files, Word documents, spreadsheets, etc. The maximum allowed file size is determined by the "Max file size" class attribute edit parameter and the "upload_max_filesize" directive in the main PHP configuration file ("php.ini").

...

AttributeTypeDescriptionExample
idstringBinary file identifier. This ID depends on the IO Handler that is being used. With the native, default handlers (FileSystem and Legacy), the ID is the file path, relative to the binary file storage root dir (var/<vardir>/storage/original by default). This attribute has been introduced in eZ Publish 5.2.application/63cd472dd7819da7b75e8e2fee507c68.pdf
fileNamestringThe human readable file name, as exposed to the outside. Used when sending the file for download in order to name the file.20130116_whitepaper_ezpublish5 light.pdf
fileSizeintFile size, in bytes1077923
mimeTypestringThe file's mime type.application/pdf
uristring

The binary file's HTTP uri. If the URI doesn't include a host or protocol, it applies to the request domain. This attribute has been introduced in eZ Publish 5.2.

The URI is not publicly readable, and must NOT be used to link to the file for download. Use ez_render_field to generate a valid link to the download controller.

Status
colourYellow
titlev5.4

Since v5.4 the property contains the binary file's content/download URL.

/var/ezdemo_site/storage/original/application/63cd472dd7819da7b75e8e2fee507c68.pdf

Status
colourYellow
titlev5.4
/content/download/210/2707

downloadCountintegerNumber of times the file was downloaded0
pathstring

*deprecated*
 Renamed to id starting from eZ Publish 5.2. Can still be used, but it is recommended not to use it anymore as it will be removed.

 

...

When creating BinaryFile content with the REST API, it is possible to provide data as a base64 encoded string, using the "data" fieldValue key:

Code Block
languagelinenumbershtml/xmltrue
<field>
    <fieldDefinitionIdentifier>file</fieldDefinitionIdentifier>
    <languageCode>eng-GB</languageCode>
    <fieldValue>
        <value key="fileName">My file.pdf</value>
        <value key="fileSize">17589</value>
        <value key="data"><![CDATA[/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcG
...
...]]></value>
    </fieldValue>
</field>