Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners

Firebird PHP Generator online Help

Prev Return to chapter overview Next

OnGetCustomUploadFileName

This event allows you to customize the file name for files uploaded with Upload file to folder and Upload image to folder editors.

 

Signature:

function OnGetCustomUploadFilename($fieldName, &$result, &$handled, 
                       $originalFileName, $originalFileExtension, $fileSize)

 

Parameters:

$fieldName

The name of currently processed column.

$rowData

The associative array of values that corresponds to the currently processed row.

$result

The actual file name. Change the value of this parameter to customize the filename.

$handled

Indicate whether the event handler executed. Set $handled to true in the event handler code to apply the changes.

$originalFileName

The original file name

$originalFileExtension

The original file extension

$fileSize

The file size

 

Example

This example shows how to add current date and time to the uploaded filename.

 

if ($fieldName === 'filename') {

    $newFileName = date('Y-m-d_H-i-s') . "_" . $originalFileName;

    $result = str_replace($originalFileName, $newFileName, $result);

    $handled = true;

}



Prev Return to chapter overview Next