You are here: jpg downloader « All PHP « IT news, forums, messages
jpg downloader

Posted by kachorro on 09/15/05 14:08

Hi all!

Ive been working in jpg downloader for my site.

The user chooses a pic and if he is a valid user, he is able to download the
pic.

My code is like that..
<?
ob_start()
?>
if (picChoose()){
if (validUser()){
header (Location: downloader.php?img=1.jpg)
}
}else{
echo from to select the pic
}
<?
ob_flush()
?>

Calling the code in upper way the img is downloaded and downloaded ok,
but, if i write the code like below
if (validUser()){
$fd=null, $buffer=null;
if ($fd = fopen ($ruta, "r")) {
$fsize = filesize($ruta);
$infoRuta = pathinfo($ruta);
$ext = strtolower($infoRuta["extension"]);

header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"".
$infoRuta["basename"]."\"");

header("Content-length: $fsize");
header("Cache-control: private");
while(!feof($fd)) {
$buffer = fread($fd, 2048);
}
}
fclose ($fd);
exit;
}

it does not work properly
the source image and the downloaded one are different
first bites form the source => ff d8 ff e0 00
first bites from the downloade one => 0a ff d8 ff e0 00 it adds 0a

does anyone know why ???

Thank in advance
Kaxorro

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация