Re: upload file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



#### ORIGINAL######
I would like in fact to make more precise my previous post.
I would like in fact to restrict the file extension (and therefore the user
possibility).

My user should be able only to upload files with extension JPEG, BMP, GIF.

How can i set those parameter ?

thx.

#### END ORIGINAL####

You can check using $_FILES pre defined global variable

$name=NAME_OF_YOUR_FILE_INPUT_FIELD

$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/png"; //Png type

if(($_FILES[$name]['type']==$cert1)
|| ($_FILES[$name]['type']==$cert2)
|| ($_FILES[$name]['type']==$cert3)
|| ($_FILES[$name]['type']==$cert4) )
{
....

} else
{
......
}

--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com
(Shopping Cart Applications, Framework
for Multilingual Web Sites, Web Designs)

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux