Re: upload image

From: Date: Thu, 24 Aug 2006 11:34:41 +0000
Subject: Re: upload image
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-241080@lists.php.net to get a copy of this message
Hi Sonja, Sonja schrieb am 24.08.2006 12:36: > Hi, > It looks like: > > $result = move_uploaded_file($image['tmp_name'], $uploadDir . > $imagePath); is $uploadDir writeable to the webserver!? check this first. if it is > > if ($result) { > // create thumbnail > $thumbnailPath = md5(rand() * time()) . ".$ext"; > $result = createThumbnail($uploadDir . $imagePath, $uploadDir . > 'thumbnail/' . $thumbnailPath, THUMBNAIL_WIDTH); check $uploadDir/thumbnail for permissions. This directory also have to be writeable. > if (!$result) { > unlink($uploadDir . $imagePath); > $imagePath = $thumbnailPath = ''; in case the thumbnail-directory is not writeable, $imagePath and $thumbnailPath get blank here > } else { > // the image cannot be uploaded > $imagePath = $thumbnailPath = ''; in case $uploadDir is not writeable, imagePath and $thumbnailPath get blank here. so your other script fails here, because it gets nothing back: > if ($images['image'] == '' && $images['thumbnail'] == > '') { > echo "Error uploading file"; > exit; > } you can make troubleshooting by first commenting out the check for uploaded thumbnail and see if the image get uploaded without "thumbnailing" it. regards Mourad

« previous php.general (#241080) next »