file size

Discussion in 'PHP' started by cavendano, Oct 12, 2007.

  1. #1
    I have a script that requires the posting of file size it is odd but mp3 wont read the file size.
    It is odd but the filesize for mp3 doesnt work but m4a does...any ideas?
    $get_size_mp3 = filesize("$dir_test_mp3");
    $get_size_mp4 = filesize("$dir_test_mp4");
    $dir_test_mp4 = temp/$sname.m4a;
    $dir_test_mp3 = temp/$sname.mp3;
    PHP:
    so if i type echo $get_size_mp4 I get a value such as 1222
    but if i type echo $get_size_mp3 I get a blank value

    any ideas would be great...
     
    cavendano, Oct 12, 2007 IP
  2. mikebrad0927

    mikebrad0927 Peon

    Messages:
    266
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    how big is the file supposed to be?
     
    mikebrad0927, Oct 12, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    Please post the code you're actually using and don't retype it here.

    filesize() has no reason to not work unless it can't open the file or the file name is given incorrectly.
     
    nico_swd, Oct 12, 2007 IP
  4. Phaaze

    Phaaze Member

    Messages:
    51
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #4
    Erm, shouldn't you define the variables before trying to get their file size?

    $dir_test_mp4 = temp/$sname.m4a;
    $dir_test_mp3 = temp/$sname.mp3;
    $get_size_mp3 = filesize("$dir_test_mp3");
    $get_size_mp4 = filesize("$dir_test_mp4");
    PHP:
     
    Phaaze, Oct 12, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    And use quotes... that's why I told him to show us his real code cause the one he posted wouldn't work at ALL.
     
    nico_swd, Oct 12, 2007 IP
  6. SGTScripts

    SGTScripts Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    PMed him how to get it to work. after i saw all the script he had two variables defined for the same thing. one good one bad.
     
    SGTScripts, Oct 13, 2007 IP