Didn’t got any luck finding an answer on google , so this is my last try before trying other methods.
I have a script like this:
// get current year and month
$cur_year = date('Y');
$cur_month = date('m');
$long_type = $this->getFile_longtype();
$folder = $_SERVER['DOCUMENT_ROOT']."/".FOLDER_CMS."/uploads/$long_type/$cur_year/$cur_month";
// check whether the folder exists
if(!is_dir($folder)){
// try to make the folder recursively
if(!mkdir($folder,"0777",true)){
logError($message, __FILE__, __LINE__);
throw new Exception("Failure creating proper directories");
}
}
to make it work , I chmod’ed the uploads directory and all it’s files and dirs to 777 ( beter suggestion here? )
The long type evaluates to ‘images’ and this is a directory has already been created on the server.
Now , the script create the folder named with year with the permissions 341. This not wat I want because it terminates the recursive folder buildup or blocks it’s content from me.
Any help or suggestions?
php version : 5.2.5
configure command : ‘./configure’ ‘–enable-bcmath’ ‘–enable-calendar’ ‘–enable-exif’ ‘–enable-ftp’ ‘–enable-gd-native-ttf’ ‘–enable-libxml’ ‘–enable-magic-quotes’ ‘–enable-mbstring’ ‘–enable-pdo=shared’ ‘–enable-soap’ ‘–enable-sockets’ ‘–enable-wddx’ ‘–enable-zip’ ‘–prefix=/usr/local’ ‘–with-apxs2=/usr/local/apache/bin/apxs’ ‘–with-bz2’ ‘–with-curl=/opt/curlssl/’ ‘–with-curlwrappers’ ‘–with-freetype-dir=/usr’ ‘–with-gd’ ‘–with-gettext’ ‘–with-imap=/opt/php_with_imap_client/’ ‘–with-imap-ssl=/usr’ ‘–with-jpeg-dir=/usr’ ‘–with-kerberos’ ‘–with-libexpat-dir=/usr’ ‘–with-libxml-dir=/opt/xml2’ ‘–with-libxml-dir=/opt/xml2/’ ‘–with-mcrypt=/opt/libmcrypt/’ ‘–with-mhash=/opt/mhash/’ ‘–with-mssql=/usr/local/freetds’ ‘–with-mysql=/usr’ ‘–with-mysql-sock=/var/lib/mysql/mysql.sock’ ‘–with-mysqli=/usr/bin/mysql_config’ ‘–with-openssl=/usr’ ‘–with-openssl-dir=/usr’ ‘–with-pdo-mysql=shared’ ‘–with-pdo-sqlite=shared’ ‘–with-png-dir=/usr’ ‘–with-pspell’ ‘–with-sqlite=shared’ ‘–with-tidy=/opt/tidy/’ ‘–with-ttf’ ‘–with-xmlrpc’ ‘–with-xpm-dir=/usr’ ‘–with-xsl=/opt/xslt/’ ‘–with-zlib’ ‘–with-zlib-dir=/usr’
Don’t use the string “0777”, use 0777.