Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/01/2006, 05:49
amit
 
Fecha de Ingreso: abril-2005
Mensajes: 12
Antigüedad: 19 años
Puntos: 0
bajar imagenes con php

Quiero bajar imagenes mediante php. Se trata de una pagina en la que muestra la imagen (cargada previamente por el usuario), se ofrece la opcion de redimensionarla, y al final la opción de bajarla al ordenador del usuario. Pero no hay manera, al bajar siempre da error al abrir el archivo descargado "Imposible determinar tipo".

Añado el codigo a ver si alguien sabe donde puede estar el error.
Los valores de $filepath y $file se crean correctamente

<?php
include "_IMconfig.inc";
require "../class/burua.php";

$filepath = $dokuerroa."/image-editor/".$_REQUEST[fl];
$file = $filepath;

while(strpos($file,"/") !== false ) {
$file = substr( $file, strpos($filepath,"/")+1);
}

//$filepath y $file se guardan correctamente

//Stop the script if file selected is invalid
if( ( !$file ) or ( !file_exists( $filepath ) ) ) {
die( "File wasnt set or it didnt exist" );
}

//Hasta aqui todo bien
header ("Content-Disposition: attachment; filename=\"".$file."\";");
header ("Content-Type: imagen/jpg");
header ("Content-Length: ".filesize($filepath));
readfile($file);

?>