File

Overview #

Enables file upload functionality.

Field Type Parameters: #

  1. Max File Size (optional) – Obsolete. The maximum upload file size is determined by the PHP.ini file. No specification needed.
  2. Folder (optional) – Directory where all uploaded files will be stored. Default is /images.
  3. File Types (optional) – List of acceptable file types, separated by spaces.
  4. Save As File Name (optional) – Specify the name for a newly uploaded file. You can use field tags [fieldname].
  5. Custom PHP (optional) – PHP file/function to process file content before download. Must be located at /components/com_customtables/customphp.

Value Processing Parameters: #

Basic usage:

{{ FieldName }}

Usage with parameters:

{{ FieldName(Security, Link, Icon, Target Window) }}
  1. Security (optional) – Encrypts the file link and restricts access time.
    • (Default. Public. Direct link to the file.)
    • timelimited – (Time Limited (8-24 minutes))
    • timelimited_longterm – (Time Limited (1.5 – 4 hours))
    • hostlimited – (Time/Host Limited (8-24 minutes))
    • hostlimited_longterm – (Time/Host Limited (1.5 – 4 hours))
    • private – (Time/Host/User Limited (8-24 minutes))
    • private_longterm – (Time/Host/User Limited (1.5 – 4 hours))
  2. Link (optional) – How the link should be displayed.
    • icon-filename-link – (Clickable Icon and File Name)
    • icon-link – (Clickable Icon)
    • filename-link – (Clickable File Name)
    • link-anchor – (Clickable Link)
    • icon – (Icon (IMG tag))
    • (Default. Link Only)
    • filename – (File Name)
    • link-to-icon – (Link to Icon file)
    • extension – (Extension)
  3. Icon (optional) – Select the icon size.
    • 16 – (16px X 16px Icon)
    • 32 – (32px X 32px Icon)
    • 48 – (48px X 48px Icon)
  4. Target Window (optional) – Target browser window for opening the link.
    • (Default. Parent)
    • _blank – (New Window With Navigation)
    • savefile – (Open Save File As Dialog)

Example:

{{ FieldName("timelimited","filename-link",32,"parent") }}

Pure Value (Unprocessed): #

Example:

{{ FieldName.value }}

Edit Record Parameters: #

Parameters for configuring the input element for file uploads.

Basic usage:

{{ FieldName.edit }}

Usage with parameters:

{{ FieldName.edit(CSS Class, Attributes) }}
  1. CSS Class (optional) – Name(s) of the CSS class(es).
  2. Attributes (optional) – Optional attributes such as: disabled, onclick, onchange, etc.

Custom PHP file that can be executed before file download, to prepare or change file content #

Custom PHP – PHP file/function that will process file content before being downloaded by the user. This only works with private file link, see security parameter above.

File must be located at “/components/com_customtables/customphp”.

Function name must be like this CTProcessFile_filename($original_file_content,&$row)

Example: {{ FieldName(“paidfile”) }}

Lets call the file “privatefile.php”

<?php

defined('_JEXEC') or die('Restricted access');

function CTProcessFile_privatefile($original_file_content,&$row){
    return str_replace('*activation_key*','23098ueu028',$original_file_content);
}


What are your feelings

Leave a Reply

Updated on January 10, 2025