Last active
January 2, 2025 08:34
-
-
Save rolandinsh/5143047 to your computer and use it in GitHub Desktop.
Codeigniter file upload permissions (CHMOD)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config['upload_path'] = './uploads/'; // upload path | |
/* OR any other form, e.g.: | |
$config['upload_path'] = $_SERVER["DOCUMENT_ROOT"].'/uploads/'; // upload path | |
$config['upload_path'] = __DIR__.'/uploads/'; // upload path | |
*/ | |
$config['allowed_types'] = 'zip'; // array or string of file extensions | |
$config['max_size'] = '100'; // max file size | |
$this->load->library('upload', $config); // do the job | |
$udata = ['upload_data' => $this->upload->data()]; // get data | |
$ufile = $udata['upload_data']['full_path']; // get file path | |
chmod($ufile,0777); // CHMOD file or any other permission level(s) | |
// ... rest of code ... | |
/* | |
Copyright 2013,2020 Rolands Umbrovskis ( https://umbrovskis.com/ ) | |
Released under the https://simplemediacode.com/license/ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice script. Thanks for sharing. :-)
I would like to share a library I have coded with the same goal.
Example of usage:
Full documentation: https://github.com/MathiasReker/php-chmod