Re: Question reading a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2011-10-27 at 15:25 -0400, Tedd Sperling wrote:

> Hi gang:
> 
> I have a few questions -- this is my first one.
> 
> Please review this link:
> 
> http://webbytedd.com/cccc/perms/
> 
> This page simply reads the contents of a file of the user's choice and displays the file's data.
> 
> My first question is with regard to reading a file ( fread() ):
> 
> If the user picks the PDF file, the [1] First 20 bytes are: %PDF... 
> If the user picks a JPG file, the [1] First 20 bytes are:  ...JFFIF... 
> If the user picks a GIF file, the [1] First 20 bytes are:  GIF89a... 
> 
> Of course, the above is just reading/echoing the header for each of those files.
> 
> Likewise, if the user picks a TXT or CSS file, then [1] First 20 bytes echoed are the first 20 characters of the file.
> 
> However, if the user picks a HTML or PHP file, there are no [1] First 20 bytes echoed.
> 
> BUT, the ord() and chr() of the bytes ARE indeed collected and can be echoed as shown in statements [2] and [3].
> 
> So, my question is specifically "Why is the data gathered in the variable $content not echoed for the HTML and PHP files, but is for all other files?" 
> 
> Please review the code shown.
> 
> Cheers,
> 
> tedd
> 
> _____________________
> tedd@xxxxxxxxxxxx
> http://sperling.com
> 
> 
> 
> 
> 
> 


This might sound silly, but is it because it's being interpreted
somehow? I could understand the HTML going a little weird because of
this, not sure about the PHP, would depend what was trying to interpret
it...
-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux