RE: [PHP] Garbage at beginning of uploaded Text File
| From: | John W. Holmes | Date: | Sun, 02 Mar 2003 02:32:42 +0000 |
| Subject: | RE: [PHP] Garbage at beginning of uploaded Text File | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137741@lists.php.net to get a copy of this message | ||
> I have a form that allows someone to upload a text file, the contents
of
> which will be inserted into the database. When I fread() the file,
there
> is
> some garbage at the beginning and end of the text.
>
> Here's what the text looks like:
>
> This is the sentence of text.
>
> Here's what it looks like after uploaded and fread():
>
> *ch?¡®ºdä?º†Ím This is the sentence of text.SORT~€ÿÿ
>
>
> The text file being uploaded is a BBedit file, which should be a plain
> text
> file. I'm not sure where this garbage is coming, and if there's an
easy
> way
> to remove it before I put this into the Database. I searched the PHP
help
> files for an hour and searched here, and couldn't find anything
related.
>
> I'm using PHP 4.2.3 on a Redhat Linux server.
>
> Thanks.
Are you using Apache2? IIRC, there was a bug where data would get added
to the POST data, or something along those lines...
What if you just look at the file with a regular text editor? Do you see
that data there after it's uploaded and written to the server, or does
it just appear into the data when it's fread()?
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/