php - Create a folder if it doesn't already exist -


i've run few cases wordpress installs bluehost i've encountered errors wordpress theme because uploads folder wp-content/uploads not present.

apparently bluehost cpanel wp installer not create folder, though hostgator does.

so need add code theme checks folder , creates otherwise.

try this:

if (!file_exists('path/to/directory')) {     mkdir('path/to/directory', 0777, true); } 

note 0777 default mode directories , may still modified current umask.


Comments

Post a Comment

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -