Reply to Re: [PHP] Strange problem with picture Upload

Your name:

Reply:


Posted by Richard Lynch on 09/30/66 11:14

On Sat, April 23, 2005 7:44 am, Labunski said:
> Hi guys,
> I have to say, I've written so many scripts that had file upload functions
> included,
> but this time something strange is happening.
>
> The script passes the IMAGE_TYPE check, and picture's name stores in the
> database (so I guess the picture should have been stored in the dir.), but
> when I look at the ftp - there's no picture in the upload directory.

I suspect your test for JPEG||GIF is messing up, and the file is getting
deleted because of that.

Try adding the line below and see what it does.

> Chmod of the directory is 777;
>
> Here it is:
>
> $realdir = $_SERVER['DOCUMENT_ROOT'].'/img/';
> $uploadfile = $realdir. basename($_FILES['postbilde']['name']);
>
> if (move_uploaded_file($_FILES['postbilde']['tmp_name'],
> $uploadfile)) {
> $put_name_en = $_POST['subject_en'];
>
> if (!empty($put_name_en)) {
> $image = basename($_FILES['postbilde']['name']);
> $check_image =
> $_SERVER['DOCUMENT_ROOT'].'/img/'.$image;
>
> if( (exif_imagetype("$check_image") ==
> IMAGETYPE_JPEG)||(exif_imagetype("$check_image") == IMAGETYPE_GIF) ){
> $put_img = $image;
> }else{
> $img_root = $_SERVER['DOCUMENT_ROOT'].'/img/';
> $kick = $img_root.$image;
> unlink($kick);

echo "INVALID IMAGE: That file looks like neither JPEG nor GIF<br />\n";

> $put_img = '';
> }
>
> mysql_query("INSERT INTO data (subject_en, img)
> VALUES ('$put_name_en', '$put_img')") OR die(mysql_error());
>
> echo '<META HTTP-EQUIV="Refresh"
> CONTENT="0;URL=update.php">';
> }
> } else {
> echo "The upload was unsuccessful !";
> }
>
>
> Sorry for my bad english,
> Thank you in advance,
> Lab.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Like Music?
http://l-i-e.com/artists.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация