Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,113 of 9,113 pages
About the help in other languages
All help pages

Files and downloads

Offer documents for download - the file class and ezbinaryfile, the content/download view and its permission check, download links in templates, searchable PDFs, protected downloads and large files.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/creators/website-creators/files-and-downloads.md

On this page

Files and downloads

This page is for website creators who offer documents, brochures or software for download. Files are content objects with a file field (ezbinaryfile); downloads go through the content/download view, which checks permissions before sending the file.

Contents

  1. How a download works
  2. Download links in templates
  3. Protected downloads
  4. Searching inside files
  5. Large files
  6. Checklist

How a download works

  • A File object (class file) holds the document in its file attribute (datatype ezbinaryfile). Uploads of non-image files become File objects (DefaultClass=file in settings/upload.ini).
  • The download address is content/download/<object ID>/<attribute ID> (kernel/content/module.php, view download, function read). The view checks that the visitor may read the object, then sends the file.
  • Because of that check, a file in a members-only section can only be downloaded by members.

The datatype's view template renders a link with name and size:

{attribute_view_gui attribute=$node.data_map.file}

Your own markup:

{def $file = $node.data_map.file}
{if $file.has_content}
  <a href={concat( 'content/download/', $file.contentobject_id, '/', $file.id, '/file/', $file.content.original_filename )|ezurl}>
    {$node.name|wash} ({$file.content.mime_type|wash}, {$file.content.filesize|si( byte )})
  </a>
{/if}
{undef $file}

Tell visitors the format and size before they click; it is also an accessibility requirement for many sites.

Protected downloads

GoalHow
Members-only filesput them in a section only members may read (Sections and object states)
Files for one customer groupa subtree limitation on content/read for that group
A time-limited documenthide it, or move it to a section visitors cannot read, when the time is over

Do not link files directly from var/.../storage/: that bypasses the permission check. The shipped rewrite rules serve stored images directly for speed; for documents rely on content/download.

Searching inside files

settings/binaryfile.ini has handlers that extract text from PDF and Word files for the search index ([PDFHandlerSettings], [WordHandlerSettings]), using external programs you install. With Solr (ezfind), file contents can be indexed too (Search with ezfind and Solr).

Large files

  • PHP's upload_max_filesize and post_max_size limit what editors can upload; set them in php.ini of the web PHP.
  • A file field can have a maximum size in the class.
  • Very large files (videos) are better hosted on a service built for them and embedded.
  • The enhancedezbinaryfile extension adds options to the file datatype (enhancedezbinaryfile).

Checklist

  • To do: Download links show format and size.
  • To do: Protected files sit in a protected section, and the download is tested logged out.
  • To do: Upload limits in php.ini fit the largest file editors need.
  • To do: File names are readable (they appear in the download address).

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x