Re: upload image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux