Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

getimagesize error...?

images php coding issues or problems here.

Moderators: macek, egami, gesf

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 ok...im 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
<?php
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.";
die();
}

if(!($type=='image/jpeg'||$type=='ima…
{
echo $type . "is not and acceptable format.";
die();
}

if($size>'350000')
{
echo $name . "over 350KB";
die();
}
if(!get_magic_quotes_gpc())
{
$nname = addslashes($name);
}

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


$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'];

if($result)
{
header("Location: xxxxx.php?xxxxxx=" . $data); ?>
<!--<script type="text/javascript">
alert("xxxxxxxxxxxxxxx");
window.location = "xxxxxxxxxxxxxxxxxxxxx.php";
</script> -->
<?php
}
mysql_close();

?>



Please guide me to resolve my problem...
maxstoto
New php-forum User
New php-forum User
 
Posts: 1
Joined: Thu Mar 29, 2012 3:09 am

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.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 277
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.