fread function problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bealox
Forum Newbie
Posts: 2
Joined: Sat Oct 17, 2009 3:38 am

fread function problem

Post by bealox »

Hi guys

can anyone tell me why it doesn't show "filesize" data when I put

fread(txt file, filesize(path));

It only shows the content of the file.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: fread function problem

Post by jackpf »

Because you're using fread() maybe??

Need more info. Whole code?
bealox
Forum Newbie
Posts: 2
Joined: Sat Oct 17, 2009 3:38 am

Re: fread function problem

Post by bealox »

Hi jackpf

this is the code

$fp4= "$DOCUMENT_ROOT/orders/orders.txt.";
$content = fopen($fp4, "r");
echo fread($content, filesize($fp4));

Thanks
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: fread function problem

Post by jackpf »

Well, if you just want the filesize, then there's no need to use fread().

Try just

Code: Select all

echo filesize($fp4);
Post Reply