getimagesize error...?

images php coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Thu Mar 29, 2012 3:09 am

getimagesize error...?

Postby maxstoto » Thu Mar 29, 2012 3:13 am

i have develop my system to enable the user to upload their picture...
I have already upload my system into my online web hosting..When im try to upload my image into my system using my smart phone, i got an error...but when im try to upload my image using my computer, its everything try to upload the "JPEG" image format.

This error is :-
Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in XXXX/XXXX/XXX/xxxx.php on line 20 is not and acceptable format..

Here my code...

Code: Select all

include ('config.php');

$name = $_FILES['picture']['name'];
$tmp_name = $_FILES['picture']['tmp_name'];
$type = $_FILES['picture']['type'];
$size = $_FILES['picture']['size'];

list($width, $height, $typeb, $attr) = getimagesize($tmp_name);

if($width>600 || $height>500)
echo $name . "'s dimensions exceed the 600 x 500 pixel limit.";

echo $type . "is not and acceptable format.";

echo $name . "over 350KB";
$nname = addslashes($name);

$extract = fopen($tmp_name,'r');
$content = fread($extract,$size);
$content = addslashes($content);

$query = "INSERT INTO xxxx values ('','$xxx','$xxxx','$xxxxx','$xxxxx','$x…
$result = mysql_query($query) or die(mysql_error());
$xxxxxx = "SELECT xxxxx FROM xxxxxxx ORDER BY xxxxxx DESC LIMIT 1";
$xxxxxx = mysql_query($xxxxxx);
$rows_r_s_b = mysql_fetch_array($rxxxxxxxx);
$data = $rows_r_s_b['xxxxxxx'];

header("Location: xxxxx.php?xxxxxx=" . $data); ?>
<!--<script type="text/javascript">
window.location = "xxxxxxxxxxxxxxxxxxxxx.php";
</script> -->


Please guide me to resolve my problem...

User avatar
php-forum Active User
php-forum Active User
Posts: 335
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: getimagesize error...?

Postby freshnet » Fri Mar 30, 2012 4:44 pm

It seems like firstly the tmp_name is empty, and also that the file type is incorrect when you're uploading from a phone. You should try echoing back as much information as possible about the image so that you can see exactly what the smart phone is doing.

Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 2 guests