Here, you can have a copy of the script I made for one of my sites.
function upload($myfile){
//declare constants
$dir = "/home/username/public_html/";
$file_name = $_FILES['myfile']['name'];
$file_type = $_FILES['myfile']['type'];
$file_size = $_FILES['myfile']['size'];
$max_size = 10240000;
$allowed_types = array("image/gif", "image/jpeg", "image/pjpeg", "image/bmp", "application/octet-stream", "text/plain", "application/x-zip-compressed", "application/vnd.ms-excel", "audio/mpeg", "audio/midi", "application/msword");
//make sure everything is fine
if($file_size >= $max_size){ echo "File is too big. Maximum size is $max_size. Your file size was $file_size."; exit(); }
if(!in_array($file_type, $allowed_types)){ echo "File type is not allowed.<br><br>Allowed types are:<br>". sort($allowed_types) ."<br><br>Your file type was: $file_type"; exit(); }
if(copy($myfile, $dir.$file_name)){ echo "Your file was uploaded.<br><br>"; } else { echo "There was an error uploading your file.<br><br>"; }
//end
}