• PHP Help
  • problem getting file size and MD5 for files in a folder

I’m having a problem getting file size and MD5 for files in a folder on my web host using php. Here’s a sample of the code as currently written.: NOTE: There's only one .tar.gz file in the folder.

<?php

$srcs = glob('download/*.tar.gz');
$src = $srcs[count($srcs) - 1];
$srcname = basename($src);   
$md5src = md5_file($src);

print_r $srcname;
print_r $md5src;
Can anybody help me with this?    
I’m not getting anything from the print_r commands.);
    $src = $srcs[count($srcs) - 1];
    $srcname = basename($src);   
    $md5src = md5_file($src);

    print_r $srcname;
    print_r $md5src;

Can anybody help me with this?
I’m not getting anything from the print_r commands.

    Start by making these the first to commands after the opening php tag:

    ini_set('display_errors', true); // set to false in production
    error_reporting(E_ALL);
    

    Then see if you get any warnings/errors that help narrow down where the problem is. (E.g., does $srcs actually get populated, or is it empty?);

      I don't know if it's a transcription error, but print_r needs parentheses after it...

      Write a Reply...