trongate / trongate-framework

The Trongate PHP framework
https://trongate.io
Other
1.12k stars 100 forks source link

Allow file upload to module #135

Closed DaFa66 closed 1 year ago

DaFa66 commented 1 year ago

Upload_file.php - Enhanced

Example1 - upload file to 'public/files' folder, keeping the name of the original file

// upload Ahoy! $config['destination'] = '../public/files'; $file_info = $this->upload_file($config);

Example2 - upload file to 'public/files' folder, changing the name to a random string

// upload Ahoy! $config['destination'] = '../public/files'; $config['make_rand_name'] = true; $file_info = $this->upload_file($config);

Example3 - upload file to the calling module's assets folder and into 'files' folder

// upload Ahoy! $config['destination'] = 'files'; $config['upload_to_module'] = true; $file_info = $this->upload_file($config);

Example4 - upload file to the 'members' module 'asset' folder and into 'files' folder with a random name

// upload Ahoy! $config['destination'] = 'files'; $config['target_module'] = 'members'; $config['upload_to_module'] = true; $config['make_rand_name'] = true; $file_info = $this->upload_file($config);

Tested and working on PHP 8.0.xx, 8.1.xx and 8.2.00