File hosting php script problem

Discussion in 'PHP' started by PashaM, Apr 23, 2007.

  1. #1
    I am using a File Hosing script on my site. (called "FreeFileHosing")
    I got this error out of the blue, i didnt change anything, it just happened:
    "Fatal error: Call to undefined function: total_size() in /var/www/html/ffh/index.php on line 38"
    What could be the problem?

    this is the relavent code in index.php:

    $fileshosted=sizeof(file("./files.txt")); //get the # of files hosted

    $sizehosted = 0; //get the storage size hosted
    $handle = opendir("./storage/");
    while($file = readdir($handle)) {
    $sizehosted = $sizehosted + filesize ("./storage/".$file);
    if((is_dir("./storage/".$file.'/')) && ($file != '..')&&($file != '.'))
    {
    $sizehosted = $sizehosted + total_size("./storage/".$file.'/');
    }
    }
    $sizehosted = round($sizehosted/1024/1024,2);
     
    PashaM, Apr 23, 2007 IP
  2. moin

    moin Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello friends,

    Could anyone suggest me code for string validation, for example, if anyone enters numbers in string then an error message should be displayed.

    Thanks.
     
    moin, Apr 23, 2007 IP
  3. Subikar

    Subikar Active Member

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Your total_size() function is unavalable in the script so it is giving error.
     
    Subikar, Apr 23, 2007 IP
  4. PashaM

    PashaM Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What exactly means "unavailable" ? How do i make it abailable?
    this is the link to this error:
    http://www.maloestado.com/ffh/
     
    PashaM, Apr 26, 2007 IP
  5. Adam A Flynn

    Adam A Flynn Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    total_size() isn't a native PHP function. The file in your script where it is declared probably isn't included or something.
     
    Adam A Flynn, Apr 26, 2007 IP
  6. PashaM

    PashaM Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    this is the line 38 of that file that gives error:
    $sizehosted = $sizehosted + total_size("./storage/".$file.'/');

    so you'r saying that this total_size variable should be defined somewhere else? and isn't there supposed to be a $ in front of total_size in that line?
     
    PashaM, Apr 26, 2007 IP
  7. PashaM

    PashaM Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ok, thanks everyone! You pointed me into a right direction... All is fixed and working now
     
    PashaM, Apr 26, 2007 IP