You are here: Re: Problem downloading binary data « PHP Programming Language « IT news, forums, messages
Re: Problem downloading binary data

Posted by Barry on 01/25/06 12:15

Erwin Moller wrote:
> Barry wrote:
>
>
>>Hi all
>>
>>I have this script(download.php) which downloads binary data from a
>>mysql database.
>>
>><?
>>
>>/* SNIP */
>>
>>$document=document::singleton();
>>$doc=$document->get_document($id);
>>
>>if (is_object($doc)){
>>die;
>>}
>
>
> So if $doc is an object you die?
>
> Is that what you want?
> I would expect:
>
>
> if (is_object($doc)){
> echo "\doc is not an object!";
> exit;
> }
>
> Regards,
> Erwin Moller
>
>

Yes I want it to die.
The function returns an error object if it fails.
This means that an error has occured and then I just die.

If the function returns an array, its found the data.

This all works for files less than 64k.
Its only with larger files that the download stops at 64k.
This is weird bahavior, I think it might be some config on the server.

Thanks
Barry

>>header("Content-type: $doc[type]");
>>header("Content-length: $doc[size]");
>>header("Content-Disposition: attachment; filename=$doc[name]");
>>
>>echo($doc['content']);
>>
>>exit;
>>
>>?>
>>
>>This is called from another page in the
>><a href="download.php?id=4">CLick here to download</a>
>>fashion.
>>
>>The problem I am experiencing is that the download stop on 64k and then
>>the files are obviously corrupted.
>>
>>I have checked that I do have the correct size in the db and I am giving
>>the correct size in the Content-length header.
>>
>>Thanks
>>Barry
>
>

 

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

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