try this, it works for me:

if ($_FILES['imagefile']['type'] != "image/pjpeg")
{
 print("File must be a .jpg.  File will not be accepted; please choose a
.jpg picture or convert the picture to .jpg format.");
    unlink($filename); // This will remove the temporary file so we don't
have to deal with it anymore.
}

  move_uploaded_file($filename, $newfilename);

--

a little different approach... it says if it is not a jpg, do not upload it,
otherwise upload it....




"Louie Miranda" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How can you filter the extension for files being uploaded on a system via
> form.
>
> here are my codes:
>
> ## code ##
> $catchfile = $_FILES['userfile']['name'];
> $uploaddir = '/var/www-upload';
> $uploadfile = $uploaddir . $catchfile;
> if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
> ## code ##
>
>
>
> -- -
> Louie Miranda
> http://www.axishift.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to