Bad Gateway
Web server received an invalid response while acting as a gateway or proxy server.
--------------------------------------------------------------------------------
Web Server at blablabla.com
el formulario es el siguiente (MAX_FILE_SIZE - 5242880)
Código HTML:
<form action="x_insertar_img.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="id_propiedad" value="<?php echo $_GET['id']; ?>"> <input type="hidden" name="num_img" value="<?php echo $_GET['num']; ?>"> <table border="0" cellspacing="0" cellpadding="3" align="center"> <tr> <td align="right" valign="top" width="150"><font class="texto">Imagen<br><br></font></td> <td><input type="hidden" name="MAX_FILE_SIZE" value="5242880"><input name="userfile" type="file" size="40" maxlength="100"></td> </tr> <tr> <td colspan="2" align="right"> <input name="opcion" type="submit" value="Agregar mas imagenes" /> <input name="opcion" type="submit" value="Terminar" /> </td> </tr> </table> </form>
el archivo x_insertar_img.php que es el action del form tiene:
Código PHP:
$id = $_POST['id_propiedad'];
$num = $_POST['num_img'];
$img = "fotos/";
$opcion = $_POST["opcion"];
include("x_mods.php");
//datos del arhivo
$nombre_archivo = $HTTP_POST_FILES['userfile']['name'];
$tipo_archivo = $HTTP_POST_FILES['userfile']['type'];
$tamano_archivo = $HTTP_POST_FILES['userfile']['size'];
$img = $img . "ID" . $id . "_" . "NUM" . $num . "_" . $nombre_archivo;
if($opcion == "Terminar" && $nombre_archivo=="")
{
header("Location: propiedad.php?id=$id&num=1");
return;
}
//compruebo si las características del archivo son las que deseo
if ( !( (strpos($tipo_archivo, "pgn") || strpos($tipo_archivo, "jpeg") ) && ($tamano_archivo < 5242880) ) )
{
header("Location: agregar_img.php?avisa_formato=true&id=$id&num=$num");
return;
}
else
{
if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $img))
{
//echo "El archivo ha sido cargado correctamente.";
}
else
{
header("Location: agregar_img.php?avisa_error=true&id=$id&num=$num");
return;
}
}
$link = conectarse();
mysql_query("update propiedades set img$num='$img' where id=$id",$link);
mysql_close($link);
if($opcion == "Terminar")
{
header("Location: propiedad.php?id=$id&num=1");
return;
}
if($num<6)
{
$num = $num + 1;
header("Location: agregar_img.php?avisa_exito=true&id=$id&num=$num");
return;
}
else
{
header("Location: propiedad.php?id=$id&num=1");
return;
}