Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save muddy-28/0f251c4173ae866d12d494b1faaaef1e to your computer and use it in GitHub Desktop.
Save muddy-28/0f251c4173ae866d12d494b1faaaef1e to your computer and use it in GitHub Desktop.
Codeigniter file upload permissions (CHMOD)
<?php
$config['upload_path'] = './uploads/'; // upload path
/* OR any oyher form, e.g.:
$config['upload_path'] = $_SERVER["DOCUMENT_ROOT"].'/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
$zdata = array('upload_data' => $this->upload->data()); // get data
$zfile = $zdata['upload_data']['full_path']; // get file path
chmod($zfile,0777); // CHMOD file
// ... rest of code ...
/*
Copyright 2013 Rolands Umbrovskis ( http://umbrovskis.com/ )
Released under the http://simplemediacode.com/license/
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment