Forum Moderators: coopster

Message Too Old, No Replies

Why i can't create directory n upload file? what i have to do?

         

hengjaya

2:02 am on Aug 13, 2005 (gmt 0)

10+ Year Member



Code :

$oldmask = umask(0);
mkdir("upload/$name", 0777);
umask($oldmask);
$fileGambar = "upload/$name/$pic_name";
copy($pic, $fileGambar);
// write comment file
$fileComment = "upload/$name/$pic_name-comment.txt";
$fp = fopen($fileComment, "w");
fwrite($fp, $note);
fclose($fp);

Result :

Warning: mkdir(upload/nana): No such file or directory in c:\program files\apache group\apache\htdocs\reg_proses.php on line 94

Warning: copy(upload/nana/CAT.JPG): failed to open stream: No such file or directory in c:\program files\apache group\apache\htdocs\reg_proses.php on line 97

Warning: fopen(upload/nana/CAT.JPG-comment.txt): failed to open stream: No such file or directory in c:\program files\apache group\apache\htdocs\reg_proses.php on line 100

Warning: fwrite(): supplied argument is not a valid stream resource in c:\program files\apache group\apache\htdocs\reg_proses.php on line 101

Warning: fclose(): supplied argument is not a valid stream resource in c:\program files\apache group\apache\htdocs\reg_proses.php on line 102

dreamcatcher

6:53 am on Aug 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi hengjaya, welcome to Webmaster World. :)

Is your server running in Safe Mode? The mkdir() function will not work if this is the case. Might be worth checking.

Alternatively, do you have the correct permissions set on the 'upload' directory where you want to create directories? ie: is it writeable?

dc

hengjaya

7:19 am on Aug 15, 2005 (gmt 0)

10+ Year Member



THANKS DC , BUT COULD U TELL ME MORE DETAIL HOW TO SETUP THE CONFIGURATION? I AM VERY APPRECIATE IF YOU CAN HELP ME ONE MORE TIME, THANKS VERY MUCH.

Romeo

10:01 am on Aug 15, 2005 (gmt 0)

10+ Year Member



There are comments to the documentation at [php.net...] that the 'mkdir' seems to be broken in PHP 5 on Windows in a way that you can't recuresively create a subdirectory path containing forward "/" slashes.

One suggestion to circumvent this is "Please use backslashes under Windows or use the constant DIRECTORY_SEPARATOR."

Regards,
R.

[edited by: jatar_k at 3:44 pm (utc) on Aug. 15, 2005]