function uploadpic($myfile,$myurl){
$sizelimit = "yes"; //Do you want a size limit, yes or no?
$sizebytes = "600000"; //size limit in bytes
$filesizebtyes = filesize($myfile);
$dir = "dir";
if ($myfile != "") {
if (($sizelimit == "yes") && ($filesizebtyes > $sizebytes)) { die("ไฟล์มีขนาดใหญ่เกิน 600 kb.");}
@copy($myfile, "$myurl") or die("The file you are trying to upload couldn't be copied to the server");
} else {
die("Must select file to upload");
}
}