This snippet can be used to serve files for download.
It can handle HTTP requests that ask to resume the download of any given file that was previously partially downloaded. Thus, enabling support for download managers that the user may be using.
The file download counters are logged and stored in files that are read and updated once a file served by this snippet is fully downloaded.
This snippet can generate a hashed download link and present the current download count for any given file.
PROPERTIES&path — string (req)
path to the file to download with trailing slash
&file — string (req)
filename of the download without any slashes
&name — string (opt) | defaults to &file
the title of the link you want to show
&hits — boolean (opt) | defaults to false
just shows the download count of &file
&resume — boolean (opt) | defaults to false
specify support for resumable download
&showhits — boolean (opt) | defaults to false
shows the hit count on a download link
EXAMPLEGive a file with a &path of `downloads/` and a &file name of `MyPackage.zip` With the &name of `My Package` and supports resume download while showing the hit count.
[[!countTrackula? &path=`downloads/` &file='MyPackage.zip' &name=`My Package` &resume=`true` &showhits=`true` ]]Output: My Package (# hits)
<a href="?download=HASH">My Package</a> (# hits)
To just show the number of times &file has been downloaded. # = the actual number
[[!countTrackula? &path=`downloads/` &file='MyPackage.zip' &hits=`true` ]]Output: #
Output pagesource: #