Problem getting filesize and MD5 from files 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.:

<?php

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

    print_r $srcname;
    print_r $md5src;

I’m not getting anything from the print_r commands.

print_r is a function so you need braces around its inputs:

print_r($srcname);
print_r($md5src);

If you still get nothing, your glob pattern probably isn’t doing what you want. Take a look at the contents of $srcs and see if it’s what you expect.

Sponsor our Newsletter | Privacy Policy | Terms of Service