Código PHP:
echo "<div align=center><br><br><b>Subir namefile/Fotos</b><br><br>";
if(!empty($_POST["accion"])){
$uploaddir = $_SERVER["DOCUMENT_ROOT"]. "/upload/";
$uploadfile = $uploaddir.basename($_FILES['namefile']['name']);
if(move_uploaded_file($_FILES['namefile']['tmp_name'], $uploadfile)) {
//con esta funcion sube con el permiso 644
#if(copy($_FILES['namefile']['tmp_name'], $uploadfile)) {
echo "Upload exitoso!!!!!!!!!!";
}else{
echo "error al subir archivo!!!!!!!!!";
}
}else{
echo "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\">
<input name=\"accion\" type=\"hidden\" value=\"send\">
<input name=\"namefile\" type=\"file\" size=\"42\">
<input type=\"submit\" name=\"enviar\" value=\"enviar\">";
}
echo "</div>";