How to check Image File

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

How to check Image File

Post by eshban »

Hi,

can anybody tell me that how i can check my browse file extension.

i want to upload only image files . If any one give any other file eg .zip then it shows the message

'File not suppport' etc.

i am doing like this

Code: Select all

$image = $_REQUEST['image1'];

		$d = explode(".", $image);

		if($d[1] <> 'jpg' || $d[1] <> 'jpeg' || $d[1] <> 'gif' || $d[1] <> 'png'){
			print 'File cannot be uploaded';
		}
jito
Forum Commoner
Posts: 85
Joined: Sat Mar 25, 2006 4:32 am
Location: india

Post by jito »

mime_content_type() or getimagesize()
Post Reply