Foros del Web » Programando para Internet » PHP »

problemas con carga de archivos

Estas en el tema de problemas con carga de archivos en el foro de PHP en Foros del Web. que puede ser si programe mi pagina para que acepte archivos de hasta 5MB (me he dado cuenta que un archivo menor a 2M si ...
  #1 (permalink)  
Antiguo 30/05/2008, 18:14
 
Fecha de Ingreso: marzo-2008
Mensajes: 173
Antigüedad: 16 años
Puntos: 0
problemas con carga de archivos

que puede ser si programe mi pagina para que acepte archivos de hasta 5MB (me he dado cuenta que un archivo menor a 2M si lo acepta) pero al tratar de cargar uno de 3.6MB me muestra el siguiente mensaje de error:

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;
    } 
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:24.