Download_XH - Manual
Version: 1.0
For: CMSimple_XH 1.8+
Description
Download_XH is a simple yet powerful plugin for offering downloadable files with automatic download counter. The plugin tracks how often each file has been downloaded and displays this information next to the download button.

Installation
- Upload the
download_xhfolder toplugins/ - Create the folder
userfiles/downloads/ - Ensure the folder
userfiles/download_xh/is writable (will be created automatically) - Place your downloadable files in
userfiles/downloads/
Usage
Basic usage
Use the following plugincall in your content:
{{{download_xh("filename.ext")}}}
With custom button text
{{{download_xh("document.pdf", "Download the document")}}}
Examples
| Code | Result |
|---|---|
|
Button with text "brochure.pdf" |
|
Button with text "Annual Report 2024" |
|
Button with text "Download all photos" |
Features
Automatic counter
Every time a file is downloaded, it is automatically counted. The counter is displayed next to the download button:
Example: "document.pdf (2.5 MB, 42 downloads)"
View statistics
Via Plugins → Download_XH in the admin menu you can view detailed statistics:
- Which files have been downloaded
- How many times each file has been downloaded
- When the first download occurred
- When the last download occurred
- Total number of downloads
File information
The plugin automatically displays:
- File size (in KB, MB, GB)
- Number of downloads
Folder structure
plugins/download_xh/
├── index.php (main file)
└── admin.php (admin interface)
userfiles/
├── downloads/ (your files here)
└── download_xh/ (statistics storage)
└── downloads.dat
Security
The plugin includes the following security measures:
- Filename sanitization (prevents directory traversal)
- Existing file verification
- Only files from
userfiles/downloads/are downloadable - Automatic MIME-type detection
userfiles/downloads/ that you want to make publicly available. Files in this folder are downloadable by all visitors.Supported file types
All file types are supported, for example:
- Documents: PDF, DOC, DOCX, XLS, XLSX, TXT
- Images: JPG, PNG, GIF, SVG
- Archives: ZIP, RAR, 7Z
- Video/Audio: MP4, MP3, AVI
- And all other file types
Button styling
The plugin uses a standard HTML <button> element. The styling is determined by your CMSimple_XH template. If you want to give the button different styling, you can do this via your template CSS:
button[type="submit"] {
/* Your custom styling here */
}
Frequently Asked Questions
Can I reset the download counter?
You can manually reset the counter by deleting the file userfiles/download_xh/downloads.dat.
Where are the downloads stored?
The statistics are stored in userfiles/download_xh/downloads.dat. The files themselves are in userfiles/downloads/.
Can visitors upload files?
No, this plugin is for downloads only. Files must be manually uploaded via FTP or file manager to userfiles/downloads/.
Does it work with large files?
Yes, but be aware of server limits (PHP memory_limit, max_execution_time, upload_max_filesize).
Troubleshooting
Downloads are corrupted
Make sure there is no whitespace before or after the <?php and ?> tags in the plugin files.
Plugin doesn't appear in menu
Check if the file admin.php is present in the plugin folder.
Counter doesn't work
Check if the folder userfiles/download_xh/ is writable (chmod 755 or 777).
License
This plugin is free to use under the GPL3 license.
Support
For questions and support, visit the CMSimple_XH forum.
