0

i wanna to upload some images for my banners but i want to send special formats to my db like jpeg and png i wrote some things like this

<?
%name=$_FILES['imgfiled']['name'];
$size=$_FILES['imgfield']['size'];
$type=$_FILES['imgfield']['type'];

if ($type==image/jpeg)
//i wanna upload png files too. but i dont know how to add it. exactly i wanna send jpeg or png and not other formats.
//now i can upload only jpeg photos 
{
//insert command
$sql=mysql_query("insert....);
//....
}

else
{
header("location:example.php");
//or some thing else
}
?>

may some body help me with this problem
please send me correct command

Edited by mike_2000_17: Fixed formatting

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by dr.4030
0

You can append image/png to filter the png image type.

if($type=="image/jpeg" || $type=="image/png")

This will upload both jpeg and png image types.
php file upload

Edited by paulrajj: n/a

0

You can append image/png to filter the png image type.

if($type=="image/jpeg" || $type=="image/png")

This will upload both jpeg and png image types.
php file upload

Thanks my dear.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.