if(!empty($_FILES["upfile"]["name"])) {
$upfile = date('YmdGis');
copy($_FILES["upfile"]["tmp_name"],$_SERVER['DOCUMENT_ROOT']."/2012/uploads/".$upfile)
or die ("The file couldn't be copied to the server");
}
if(!empty($_FILES["upfile"]["name"])) {
$upfile = date('YmdGis');
$file_type = explode('.',$_FILES["upfile"]["name"]); //หานามสกุลไฟล์
copy($_FILES["upfile"]["tmp_name"],$_SERVER['DOCUMENT_ROOT']."/2012/uploads/".$upfile.'.'.$file_type['1'])
or die ("The file couldn't be copied to the server");
}