You are here: RE: [PHP] download not working « PHP « IT news, forums, messages
RE: [PHP] download not working

Posted by "Albert" on 12/28/05 15:22

Ross wrote:
> The pdf is fine, there are no errors . All I get is a small (130byte) pdf
> file which is corrupt when I try and open it.

From the code I gather you are saving the uploaded file in the database.
1 - What field type are you using for this?
2 - Are you using some form of encoding (eg base64_encode()) before writing
it database and decoding when reading it from the database?
3 - Why not save the file to disk with a reference to the correct filename
in the database? It will most probably solve your issue.

I have tried this saving the file into the database before and could only
get it to work reliably by:
- base64_encode() on the content of the file
- keeping the files below 100kbyte (It was way back with MySQL 3.x and it
seemed that MySQL couldn’t save such large amounts of data in a blob or text
field

I ended up uploading it to disk into a directory not accessible to someone
from the outside but accessible by the user Apache was running as. Then by
reading the content from the file with PHP and outputting in a similar
method as you are using.

Hope it helps

Albert

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.8/215 - Release Date: 2005/12/27

 

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

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