Permission problems encountered in mkdir directory creation in Codeigniter and their solutions

  • 2021-07-09 07:34:15
  • OfStack

Today, when uploading files with Codeigniter (deployed on Centos), the following error is prompted:

A problem was encountered while attempting to move the uploaded file to the final destination.

Related codes:


// Directory detection
if (!is_dir($cache_path)) mkdir($cache_path, '777');

Modify the following code to solve the problem:


// Directory detection
if (!is_dir($cache_path)) mkdir($cache_path, 0777);


Related articles: