Hi.
This is my file upload code. It works fine except it won't make new directories.
Giving me this error
<b>Warning</b>: MkDir failed (No such file or directory) in <b>/usr/local/etc/httpd/vhosts/idsnap.com/htdocs/test/upload.php</b> on line <b>13</b><br>
What am i supposed to do?
<?
$UPLOAD = fopen( $userfile, "r" );
$contents = fread( $UPLOAD,$userfile_size);
fclose( $UPLOAD );
$i = strlen($userfile_name) - 4 - 4;
$id = substr($userfile_name,4,$i);
$savedir = "/cust".$id."/";
if ( !file_exists ($savedir) ) {
$oldmask = umask(0);
$r = mkdir( $savedir, 0777);
umask($oldmask);
}
$SAVEFILE = fopen( $savedir.$userfile_name, "wb" );
fwrite( $SAVEFILE, $contents,$userfile_size);
fclose( $SAVEFILE );
echo $userfile_name."--";
echo $userfile."--";
echo $savedir."--";
echo "Server HaD Receive the Upload File!";
?>