Código:
$$sql_pic = "select max(id) as ultimo from picture"; $pic = mysql_query($sql_pic); $row_pic = mysql_fetch_assoc($pic); $max_pic = $row_pic["ultimo"]; for($i=0; $i<count($HTTP_POST_FILES['foto']['tmp_name']); $i++) { $max_pic=$max_pic+1; $newname = $max_pic.".jpg"; $newpath = "../ph/".$iduser."/".$newname; $namefile = $HTTP_POST_FILES['foto']['name'][$i]; $tmp_name = $HTTP_POST_FILES['foto']['tmp_name'][$i]; if (!empty($namefile)) { if ((substr($namefile,-4) == ".jpg") || (substr($namefile,-4) == ".gif") || (substr($namefile,-4) == ".JPG") || (substr($namefile,-4) == ".GIF")) { $dirLogos = '../ph/'.$iduser.'/'; $uploadFile = $dirLogos . $namefile; $nuevonombre = $dirLogos . $newname; $newpath2 = "../phs/".$iduser."/".$newname; if (is_uploaded_file($tmp_name)) { copy($tmp_name, $newpath); copy($tmp_name, $newpath2); //rename($uploadFile, $nuevonombre); redimensionar_imagen($nuevonombre, $nuevonombre, 500, 400); redimensionar_imagen($newpath2, $newpath2, 100, 75); chmod($newpath,0777); chmod($newpath2,0777); $insert_pic = mysql_query("insert into picture(id,pictures_siteid,filename,main) values('$max_pic','$max_ad','$newname',0)"); if ($i==0){ $update_ad = mysql_query("update vehiculos set picture = '$max_pic' where id = '$max_ad'"); $update_ma = mysql_query("update picture set main = '1' where pictures_siteid = '$max_ad'"); } } else { print "Problemas con el archivo. A continuación algo de debug:<br>"; print_r(nl2br($_FILES)); } } else { print "Las imagenes deben contener extension .JPG o .GIF"; } } } } //if insert auto header("Location: list.php"); exit();
como les dije, localmente me carga sin drama, pero online cero onda :(