Problem retrieving filesize() in php

I’m trying to get the filesize of a file in the download folder of my website so I can post it on the download page. The code is in a php block. Here’s the code I’ve tried to get it:

$test = $pdo->query("SELECT filename FROM files WHERE id =1");
   $isoname = $test->fetchColumn();
   $isotest = "download/".$isoname;
   $isosize = filesize(isotest);

I’ve tried seeing the $isosize value using both print_r() and var_dump() without success. Can someone point out where I’m going wrong?

You’ve missed a $ here, it should be:

$isosize = filesize($isotest);

You should have seen an error when running this code. If you didn’t, you may not have error reporting set up to show you problems. I’ve written a bit about this in part 1 of this article.

Thanks. Don’t know how I missed that.

Sponsor our Newsletter | Privacy Policy | Terms of Service