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

Subscribe to our news:
Partners
Testimonials
Charles Phillips: "I very much like the program and all of its functionality! Would be happy to give you an endorsement or recommend it to others - saves me a ton of time".
Charles Phillips: "Just want to take a second to really thank you for all the great support you give – I think that’s by far the best feature you offer".

More

Add your opinion

PHP Generator for MySQL 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