Image Upload Script

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
spec36
Forum Commoner
Posts: 28
Joined: Thu Nov 19, 2009 6:07 pm

Image Upload Script

Post by spec36 »

I am playing with an image upload script and everything seems to be working, but I get this error/warning message,

[text]Deprecated: Function eregi() is deprecated in....[/text]

Looks like eregi will no longer be available in PHP6. Does anyone know what I can use instead of eregi in the below code?

Code: Select all

 if(!eregi('image/', $_FILES['attachement']['type'])) {

      echo 'The uploaded file is not an image please upload a valid file!';

    } 
ANy help would be greatly appreciated.
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Image Upload Script

Post by oscardog »

I am not sure if it's the exact same syntax but I believe [urhttp://php.net/manual/en/function.preg-match.php]preg_match[/url] will do a similar job to eregi.
Post Reply