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

Subscribe to our news:
Partners
Testimonials
George Westrup: "I have saved so much time using your products. Also you are quick to respond to every question I have had. Thanks for the great support".
Kirby Foster: "Nice software. Small, lightweight, works well. I evaluated lots of software before deciding that your software worked the best for what I do. Both Maestro for MySQL and PHP Generator have saved me lots of time".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

OnFileUpload

This event allows you to control file uploading. It fires on uploading a file with Upload file to folder and Upload image to folder editors.

 

Signature:

function OnFileUpload($fieldName, &$result, &$accept, $originalFileName,
                       $originalFileExtension, $fileSize, $tempFileName)

 

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 (with full path). Change the value of this parameter to customize the filename.

$accept

Indicates whether the file uploading is allowed. Default value is true. Set $accept to false to cancel file uploading.

$originalFileName

The original file name (including extension)

$originalFileExtension

The original file extension

$fileSize

The file size

$tempFileName

The temporary filename of the file in which the uploaded file was stored on the server.

 

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

}



Prev Return to chapter overview Next