|
Posted by tomek on 01/23/06 10:24
hi
i'm desperate... i'm trying this for 2 days now... so if anyone can help -
please.
i have upload form in which users can choose TYPE of file they are uploading
(graphic/text/music) - and STATUS of that file (draft/finished). So, my
upload script is getting:
- $_FILE field,
- TYPE of file (it is string representing "DIRECTORY")
- STATUS of file (it is string representing "SUBDIRECTORY")
i cannot find working function or script to upload file to
"DIRECTORY/SUBDIRECTORY/" if that 2 dirs doesn' exist.
how can i create 2 dirs ? i tried recursively...
=================================================
function mkdirs($dir, $mode = 0777, $recursive = true) {
if( is_null($dir) || $dir === "" ){
return FALSE;
}
if( is_dir($dir) || $dir === "/" ){
return TRUE;
}
if( mkdirs(dirname($dir), $mode, $recursive) ){
return mkdir($dir,0777); // the default chmod
}
return FALSE;
}
==================================================
but it only creates first one, but not other (subdirectory) - like created
dir doesn't have permissions ??
anyone?
Navigation:
[Reply to this message]
|