Skip to content

12. File field type*

JoomlaBoat, LLC edited this page Jan 10, 2025 · 1 revision

Moved to https://ct4.us/docs/

File field type provides file upload functionality to your website users.

Field type parameters:

Max File Size - Maximum file size that can be uploaded to the server (in megabytes). Note: check your PHP settings as well. Min=1, max=1000;
Folder - Folder where all the files will be kept. By default /images;
File Types - List of acceptable file types (list separated by space)". default acceptable file types: doc docx xls xlsx pdf pages ppt pptx;
Save As File Name - Specify the name of a newly uploaded file. You may use field tags [fieldname].

Input Element Parameters

CSS Class - Name or names of CSS class(s).
Attributes - Optional attributes like: disabled, onclick, onchange etc.

Dynamic field output parameter - The link to the file.

Security - Encrypts the link to the file and limits access time to it.

public - Provides direct link to the file.
private - The link will stay active for 8 to 24 minutes.
private_longterm - The link will stay active for 1.5 - 4 hours)

Example: [paidfile:private_longterm]

Pro Version field parameter

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: [paidfile:private,privatefile.php]

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);
}