This might give you a start, this works fine for me on UNIX, the absolute directory is sometimes difficult to find though.
$updir = "/absolute/path/toupload/directory"; //absolute path to where files are uploaded
$sizelim = "yes"; //do you want size limitations yes or no
$size = "400000"; //if you want size limited how many bytes
$certtype = "no"; //do you want certain type of file, no recommended
$type = ""; //what type of file would you like
//error if no file is selected
if ($file_name == "") {
die("No file selected to upload");
}
//error if file exists
if (file_exists("$updir/$file_name")) {
die("The file you are trying to upload already exists");
}
//error if file is to big
if ($sizelim == "yes") {
if ($file_size > $size) {
die("The file you are trying to upload is too big.");
}
}
//error if file isn't certain type
if ($certtype == "yes") {
if ($type != $file_type) {
die("The file you are trying to upload is wrong type");
}
}
@copy($file, "$updir/$file_name") or die("The file you are trying to upload couldn't be copied to the server");