This is a discussion on Filesize problem. within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I am trying to determine if a file contains information. I thought the easiest way to do this would be ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am trying to determine if a file contains information. I thought the
easiest way to do this would be to check the files size. So I wrote the following code. <html> <head> </head> <body> <?php $file_size = filesize("manager/coupon.inc"); echo "file size=" & $file_size; include("manager/coupon.inc"); ?> </body> </html> What happens is it will display a 0 (zero) followed by the actual contents of the file. I added the include command just to see if I could access the file from the root directory. Sort of to test the permissions and such. It works, but again the file size is coming out as zero. HELP please. Thanks for any suggestions, I am still very new to PHP. Lee A. Wentzel |
|
|||
|
Lee A. Wentzel wrote:
> I am trying to determine if a file contains information. I thought > the easiest way to do this would be to check the files size. So I > wrote the following code. [...] > > <?php > $file_size = filesize("manager/coupon.inc"); > echo "file size=" & $file_size; > include("manager/coupon.inc"); >> An ampersand (&) is a bitwise operator in PHP. What you really need is either a dot to concat the parts or a comma (does not work with print): echo "file size=" . $file_size; echo "file size=", $file_size; Or simply: echo "file size=$file_size"; JW |