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

Recommended Answers

All 2 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.