| Home > PHP > Get the size of a file | The PHP website created by its users!
|
|
|
Get the size of a file
PHP Code
<?php
Comments jumbosheep / 28 Nov 05do you have to open the file in read mode first though? jumbosheep / 28 Nov 05i dont understand why this wouldnt just make the variable have a value of "myfilename.gif" , by putting single quotes around it, does it make it special? mkeefe / 30 Nov 05The variable "$file" is being filled with the quoted string. You would use this in a completed project more because it allows you to change things later down the road. The "filesize" function does not require you to open the file to check the size. A good use for this is to check for filesize before you open it to ensure the file is intact and won't crash your system. Matt Jesse / 3 Dec 05This is pretty cool this may come in handy thanks so much. What version of PHP is this for, I have 5.0 or so locally, but my host is 4.1.3 (I think) and some things I read in my PHP 5 book wont apply to my host. :( jumbosheep / 7 Dec 05it'll work in 4 easily whats the difference between single and double quote in php? Admin / 5 Jan 06PHP will parse code in double quotes, but not single quotes. Using single quotes for echo'ing will make your php code faster, though not really noticable. |