To know extension I found this nice function (
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_26341600.html:):
<?
$file = explode(".", $_FILES['your_var_name']['
name']);
$extension = array_pop($file);
?>
If you wish to limit file types user can upload there is a nice funciton here (
http://php.net/manual/en/features.file-upload.php):
<?php
$file = $_FILES['userfile'];
$allowedExtensions = array("txt", "rtf", "doc");
function isAllowedExtension($fileNa
me) {
global $allowedExtensions;
return in_array(end(explode(".", $fileName)), $allowedExtensions);
}
if($file['error'] == UPLOAD_ERR_OK) {
if(isAllowedExtension($fil
e['name'])
) {
# Do uploading here
} else {
echo "Invalid file type";
}
} else die("Cannot upload");
?>
Hope this helps