Private Label and Cobranded VoIP Solutions
BrainCast internet & phone based message/memo recording & reminder organization system
Internet Phone Service and Broadband Phone Service by ViaTalk

Go Back   VoIP Forums, Internet Phone Service Forums, & Web Hosting Forums > CoderForums - Programming Discussion > General Programming Issues > Programming Languages & Technologies > PHP

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-03-2002, 02:17 PM
Reaver's Avatar
Reaver Reaver is offline
is right behind you.
 
Join Date: Sep 2001
Location: BC, Canada
Posts: 118
Using filesize

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
__________________
alextaylor.org
Reply With Quote
  #2  
Old 02-03-2002, 02:24 PM
Reaver's Avatar
Reaver Reaver is offline
is right behind you.
 
Join Date: Sep 2001
Location: BC, Canada
Posts: 118
Ahh, nevermind about the first part, in the filesize() statement I just changed the ' to " and it worked

I'm still stumped about the second part though, about the display of the filesize.
__________________
alextaylor.org
Reply With Quote
  #3  
Old 02-03-2002, 02:38 PM
DCE's Avatar
DCE DCE is offline
On the run.....
 
Join Date: Jan 2001
Location: Here and there
Posts: 690
Try a search at PHPBuilder like this one
There's quite a few threads there that look relevant.
__________________
DCE

If everything seems to be going well, you have obviously overlooked
something.
Reply With Quote
  #4  
Old 02-04-2002, 01:07 AM
Reaver's Avatar
Reaver Reaver is offline
is right behind you.
 
Join Date: Sep 2001
Location: BC, Canada
Posts: 118
Thanks DCE, I found what I was looking for
__________________
alextaylor.org
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump