I've just written an upload script, however when I try to use the copy function my script cannot recognise the directory I am trying to copy to, even though it knows the file exists.
Can anyone help me out?
if(($_FILES['userfile']['type'] == "image/pjpeg") || ($_FILES['userfile']['type'] == "image/gif") && ($_FILES['userfile']['size'] < 122880)) {
// Check Directory Exists
if(!file_exists($logo_dir)){
$oldUmask = umask(0); # set mask
if(mkdir($dir, 0777)){ # create base directory
mkdir($logo_dir, 0777); # create logo directory
}
umask($oldUmask); # unset mask
}
if(file_exists($logo_dir)) {
echo 'Perform Upload in second selection';
if(copy($_FILES['userfile']['tmp_name'], $logo_dir)){
echo 'File uploaded succesfully.';
} else {
echo 'File upload failed, please contact Jobclever support.';
}
}
// Upload
} else {
echo 'An error occured uploading the specified file. This could have occured because:<br/>';
echo '- The file was an incorrect filetype, please supply the image in either GIF or JPEG formats.<br/>';
echo '- The file was larger than 120KB.<br/>';
}