I am in the process of copying a website and its database structure. Everything has been working great except the uploading of pictures. The user can log in and upload a picture as an account picture. When the code is executed I just get a blank screen and have to start over. Any ideas why? Here is the code I am working with :
// make a note of the location of the upload form
$uploadForm = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self .'editprofile.php'; //Working
$photourltest=$_FILES['photourl'];
if (($_FILES['photourl']['type'] != 'image/jpeg') && ($_FILES['photourl']['type'] != 'image/pjpeg')) {
$photo=$_POST['photo'];
if ($photo == "") {
$photo = "http://www.somekindofsite.com/id/images/keys.jpeg";
}
} else if ($_FILES['photourl']['error'] > 0) {
echo 'Problem : ';
switch ($_FILES['photourl']['error'])
{
case 1: echo 'File exceeded upload_max_filesize';
echo "Please press the back button to re-edit";
break;
case 2: echo 'File exceeded max_file_size';
echo "Please press the back button to re-edit";
break;
case 3: echo 'File only partially uploaded';
echo "Please press the back button to re-edit";
break;
case 4: echo 'No file uploaded';
echo "Please press the back button to re-edit";
break;
case 6: echo 'Cannot upload file: No temp directory specified';
echo "Please press the back button to re-edit";
break;
case 7: echo 'Upload failed: Cannot write to disk';
echo "Please press the back button to re-edit";
break;
}
//exit;
} else {
//put photo into directory
$directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
$uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'images/'; //*
$upfile = $uploadsDirectory.$_FILES['photourl']['name'];
$photo = 'http://www.somekindofsite.com/images/' .$_FILES['photourl']['name'];
//moves the file to its final location and allocate the new filename to it
@move_uploaded_file($_FILES['photourl']['tmp_name'], $upfile)
or error ('recieving directory insufficient permission', $uploadForm);
}