Reply to Re: PHP / mySQL Upload Problem - PDF Files

Your name:

Reply:


Posted by peter on 11/02/06 12:09

> I found a private messaging script online which I've modified to allow
> my friends to attach files when they send me a message. It seems to
> work great for text files, pictures, etc - basically everything I've
> tested except for PDF files.
>
> When I try to upload a PDF file with the script, 9 times out of 10, the
> contents of the PDF (glyph-like characters) end up getting printed out
> on the screen in my browser. A few other times, nothing at all happens
> (the script just doesn't seem to finish running).
>
> The pertinent parts of my HTML form:
>
> <form name="form1" method="post" action="index.php"
> ENCTYPE="multipart/form-data">
>
> <td width='50'><input type="file" name="binFile" class="box" size="25"
> /></td>
>
>
> And here's the PHP that inserts it to the database:
>
> <snip>
> $Query11 = "INSERT INTO ".MESSAGES_TABLE." (date, recipient,
> sender, subject, body, unread, folder, bin_data, filename, filesize,
> filetype)
> VALUES(".TIME.", '".$Row5['user']."',
> '".COOKIE_USER."', '".addslashes($_POST['subject'])."',
> '".addslashes($_POST['body'])."', '".$unread."', '".$folder."',
> '".addslashes(fread(fopen($binFile, "r"), filesize($binFile)))."',
> '".$binFile_name."', '".$binFile_size."', '".$binFile_type."')";
>
>
> Are PDFs oddball files, or am I doing something wrong with my query?

why upload the pdf to the database why not just upload the path to where the
file is? It is not really advised to store large files on the database (even
tho you can) even mysql.org advises against it.

[Back to original 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

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