verify file against array?

From: Date: Mon, 20 May 2002 19:26:20 +0000
Subject: verify file against array?
Groups: php.general 
Request: Send a blank email to php-general+get-98506@lists.php.net to get a copy of this message
I am trying to register an array containing file types, htm, jpg, jpeg, gif and pdf. I think I am missing something, if someone could look at this and tell me what I am doing wrong that would be awesome, thanks in advance. jas <?php $types = array(".gif"=>"1", ".jpg"=>"2", ".jpeg"=>"2", ".htm"=>"3", ".pdf"=>"4"); if ($img1_name != "" && eregi('$types', $img1_name)) { @copy("$img1", "/path/to/images/$img1_name") or die ("Could not upload file, please try again after making sure the file is less than 2mb in size and the file name correct"); } else { die("No file selected for upload, or the file was not the correct type. Please only upload .jpg files."); } ?>

« previous php.general (#98506) next »