to count file downloads or image views, i would create a database that stores info for each file. This database would hold the file name/ location / info, and an index number.
on your download page it would have links that would point to a download counter, ie: download.php?id=1 or whatever file it was.
Then in your download.php, it would update the download count everytime that page was requested.