I'm making a downloads page for a client, which on the admin end has a form that you fill out, among other things, the path to the file. I used the filesize statement to get the size of the file and add it to the DB along with the other information, but here's the problem:
As far as I know, filesize() only works with a local server path. That's fine with me, but when I go to post the link on an HTML page, of course a local path won't work.
So I tried the following:
PHP Code:
$size = filesize('/home/pcfxcc/public_html/$path');
Where $path would be what the user entered. I thought I could just append the local server address onto the path variable just for the filesize, and simply use $path alone when it grabs it for the HTML page, but it didn't work. Is there any way around this?
Also, filesize returns the size in bytes, which is rather ugly. Is there any easy way to convert that into something more friendly, like 1.1MB, etc?
Thanks
