php - CodeIgniter - Message: mkdir(): Permission denied on Ubuntu -


i'd please. have php script inside post_model constructor

$dir = fcpath . 'uploads' . directory_separator . 'posts';  if (!is_dir($dir)) {     mkdir($dir, 0755, true); }  

which shows me error:

severity: warning  message: mkdir(): permission denied 

the main idea project has ability create users , these users can upload images, or create folders-albums stored in uploads folder.

i've been struggling fix error last days , can't find solution. have tried code , on windows , works great, not on linux (ubuntu 14.04)

even had same problem , tried umask, worked. can this,

$old = umask(0); mkdir($dir, 0755, true); umask($old); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -