Forum Moderators: coopster
$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
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
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]