Hello, I am trying to get my image upload script to work, but it keeps giving the error, here is the code:It keeps throwing out the "Error uploading the file!" error. Any idea why? ThanksPHP Code:function uploadPic() {
$path = 'team_pics/';
$uploadpath = $path.basename($_FILES['imgfile']['name']);
if (!move_uploaded_file($_FILES['imgfile']['tmp_name'], $uploadpath)) {
die ('Error uploading the file!');
}
$img_name = "$path".$_FILES['imgfile']['name'];
$imageName = $_FILES['imgfile']['name'];
list($width, $height) = getimagesize($img_name);
$new_name = "team_pics/thum_".$_FILES['imgfile']['name'];
$newImage = "thum_".$_FILES['imgfile']['name'];
$new_width = 155;
$new_height = 90;
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($img_name);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $new_name, 100);
echo 'image uploaded';
}



Reply With Quote

Bookmarks