This is an original Drupal module that keep track of file download count.
The biggest different between Download Count module and this module is that this module works under the Drupal's public file system while Download Count module works under the Drupal's private file system.
First of all, let me briefly explain about the Drupal's two file systems.
Drupal's file system
- Public file system
Uploaded files are directly downloaded from the server using HTTP. Drupal does not have any control over this downloading process. The files are needed to be placed to the directory under the server's DocumentRoot directory so that it can be directly accessed.
All uploaded files can be downloaded by anyone, and even can be downloaded by tying the files URL directly without going through the download page. As default, Drupal uses public file system.
- Private file system
Uploaded files are placed to a directory where users can not directly download them. Drupal has to process the download request and handle it.
Usually you create a directly outside of the server's DocumentRoot so that the file can not be downloaded directly by specifying the URL. The special file path including '/system/file/...' is used for this file system. You can limit the download by roles, users, etc...
If you want a secure and more control over the files you distribute at your site, you'd better use the private file system with Download Count module.
Public Download Count module is intended for the following people:
- Those who needs to use the public file system for some reasons, and yet want to keep track of file download count.
- Those who want to keep track of download count of the files on different servers.
Key features
- It is desined to work under Drupal's public file system.
- It can count the download of the file on external servers.
- You can specify the valid extensions of the target files.
- You can see the yearly, monthly and daily download count for each file.
- You can export the download count data as a CSV format file.
- It does not modify the original contents.
Using Public Download Count module is similar to use external file download CGI program. The anchor HTML tag for a direct file download is automatically converted to use the external PHP script of this module on the fly instead of using Drupal's internal hook mechanism. This is totally different from the Download Count module although the functionality is similar. With this anchor tag conversion method on the fly, Public Download Count module can count the number of download of the files that are located on the external sites.
Installation
Download the module at the Public Download Count project page at Drupal.org. Then, extract the archive at the module directory of your site. Then, enable the module at the Administer > Site building > Modules page.If you install the module to neither (drupal-root)/modules directory nor (drupal-root)/sites/(your-sitename)/modules directory, then you may need to do the following extra steps to make this module work.
The external PHP script (pubdlcnt.php) may not work as it is depending on the installation directory. If you see any error message when you testing the file download with this module enabled, please edit the top portion of this file as follows:
Before
After
- // print "Error: Public Download Count module failed to work. The file pubdlcnt.php requires manual editing";
As you see above, delete the line that displays an error message and then change the next line with actual absolute path to the Drupal root of your server. Besides, this is just a example, and you need to replace 'absolute-path-to-drupal-root' with the real absolute path that matches to your server and Drupal installation.
How to use (1) Module configutation
Once the installation is completed, go to the Administer > Site configuration > Public Download Count page, and specify the file name extensions of the target files. Extensions are case insensitive.
That's all you need to do. Now, the module is ready to work.
How to use(2) View download counts
To view the download counts of files, go to the Administer > Reports > Public Download Count page. You will see the list of files and their total download count (see the example below).
Clicking file name will jump to the page(node) where you can download the file. To reset the download count of a file to 0, click the "Reset" link. To view the detail download count statistics of a file, click the "Details" link.
When you click the "Detail" link, you can see the yearly, monthly and daily download count of the file (see the example below).
How to use(3) Export download count data
You can export the file download count data as a CSV format (comma separated text format) file, which you can open with Excel and other spreadsheet programs later.
How to use(4) Display download count in nodes
As you can see the example below, Public Download Count module can display the total download count of the file right after the link to download the file.
If you are an administer, then clicking the download count will jump to the detail download count statistics page of the file.
You can show this total download count to any users (without the link to the statistics page).
To do this, go to the Administer > User management > Permissions and enable the "view total download count in nodes" checkbox for the role you want to allow.
How to use (5) Creates blocks
This modules can show top download file list of specified time period to a block. You can create as many blocks as you like at the module's configuration page. Once you specify the number of blocks you want to use, then the blocks are created. Go to the Blocks page and customize each blocks.
You can specify the number of items to be shown to a list. You can also select if you want to add anchor to nodes of which the files can be downloaded. For the time period of counting, you can select either one of Last Year, This Year, Last Month, This Month, Last Week, This Week, Yesterday and Today.
The block you creates would look like this.
Clicking file name will jump to the node(page) where user can download the file. You can also show the download count after the file name depending of the user role and permissions. You can assign the permission "view total download count in block" to the role you want to show the counter value.
Only the admin user have the count with the anchor to the statistics page of the file.
Technical Details
Public Download Count module works with any anchor tags that meets the following criteria.- The anchor tag must have URL with a file name at the end. It does not work with the anchor tags whose URL is a directory name
- The anchor tag must not have a query string. For example, the following anchor tag is ignored by the module.
<a href="http://example.com/prog.php?param1=XXX¶m2=YY">
- The anchor tag must have a file name with a valid file name extensions specified at the module configuration page.
- The anchor tag must not have a file path to the private file system (which includes /system/files in its path)
- The anchor tag must be in nodes, not in comments. This module does not handle anchor tags in comments.
- The anchor tag must not have "rel=lightbox..." attribute. (thickbox and shadowbox too).
NOTE: Public Download Count module conflicts with the image files that uses lightbox, thickbox and shadowbox. So currently they are excluded from the target.


Doesn't work with COntent Templates
Very good module, but it doesn't work with Content Templates (or content types created with CCK). Hope you can fix this.
It supports CCK
I'm using some content type created by CCK and filefield and the public download counter works OK with the files attached by the filefield module.
I need more detail information on your problem to fix it.
1) absolute path of the drupal root directory in the server
2) absolute path of the public download count installed directory
3) absolute path of a file that does not count
4) URL of the file (see the status bar when you move mouse over to the file download link).
5) confirm that the file name extension of the file is included in the valid extensions of the module settings page.
Thanks,
It supports CCK. but, sure
It supports CCK. but, sure thing, it doesn't work with Content Templates.
this is a php snippets in my node-*.tpl.php, pubdlcnt doesn't work!
I fix it as follows:
But it's too complex, and I don't know how to output counts.Hope fix this,thanks a lot :)
Views
This module looks very promising and might be just what i need. I do have two questions though.
1) Can the text output by the module into the node be edited and, if so, how?
What i mean is that just (number) is a bit sparse and uninformative. I would like it to say something like "this file has been downloaded # times"
2) Is it possible to use this module's data through views? I am making a, tabled, overview of files uploaded by user, i would like it to show visitors to see how many times a file has been downloaded and to allow them to sort by most/least downloaded.
regards,
a curious user
With beta4 release, the issue
With beta4 release, the issue (2) is supported, while (1) is not yet.
You can edit the module source file pubdlcnt.module to change the counter form (number) to something different.
I will make it customizable with the next release.
Great job
Thank you for such a useful module :)
However, how can I utilize the counter info (the issue #2) in my custom view (The Views module)?
Thanks a lot
Hey,
Just wanna say thank you very much!!!!!!!!!! this is even better than I expected!
works great with filefield thanks a lot
Any way to count MP3 plays via 1pixelout with swftools
I realize it may take some editing of php templates but can you think of an easy way to make this module count plays of an mp3 which is using swftools and ffpc module to create player?
MP3
Hi,
I have a content type called "Audio List", which is just a bunch of CCK FileFields. I have installed SWFTools and 1pixelout audio player and assigned the MP3 files to be handled by it. In Content Types >> Edit Audio List >> Display Fields I have set it to display as "SWFTools - no download links". Then I uploaded a few MP3s. The first problem is that it does not display the Caption text entered for each of the files. But the biggest problem is that if I start playing one of the audio files and then click the "play" of another file, the previous player does not collapse and stop playing, but continues to play simultaneously. Naturally, a user of SWFTools would expect the same behavior as the Audio-Player plugin in Wordpress: if you're already playing first song and then suddenly click the play button of another file, then the first player should collapse and stop playing, so that the second song begins playing.
If I overlooked one of the settings, please treat this is as a support request and please tell me how to do it right.
If not, then I guess this is a bug report which needs to be corrected.
How about multisite install ?
is there any settings for multisite drupal install ? can you tell here if your module work with multisite ?
thanks
Thanks!
Just a quick note to thank you for this module! Easy to use and just what I need.
Only thing that isn't working for me is that when I click the link of the file name under on the reports page, I get sent to "mysite.com/node/" for each of the files, instead of the correct node where I can download the file (using version 6.x-1.0-beta5). No big deal for me though. Just wanted to point it out in case :)
Wrong links to nodes
I have the same problem. All files link to "example.com/node/4903"
6.x-1.0-beta5
Node count working on some files but not others?
http://musime.excalibur-nw.com/sheets_by_title/a
On this page, the midi count is working in both the block and internal statistics page. However, the pdf is only working in the block and stats but not the count next to the node.
http://musime.excalibur-nw.com/sheets_by_title/s
On this page, nothing works.
Do you know what could be wrong?
Figured it out
Nvm, figured it out. For some reason the files with "spaces" in the name wouldn't show up for the node count. These were the files I uploaded prior to installing the filefield paths module to replace spaces with hyphens on user uploaded files.
Handling files with spaces
I had the same problem when using this module for filenames with spaces. You can also solve it by patching the file pubdlcnt.module, as follows:
Locate the function named:
(it is probably on line 181)
Now add the following line of code as first line in the function:
So the total function looks like:
Hope the author(s) will patch it in one day. Thanks BTW for this module! Working great for me. Cheers!
No Apture Capture
Doesn't seem to be working with Apture either. All my links are Apture enabled.
doesnt work for mp3 player module
Hi
I'm currently using mp3player module, which uses 1pixelout player in a CCK filefield.
But when I click on play, count remains to zero.
Did I miss something ?
invalid link
Item display i have set to "File name - link to node".
I have a file stored in the directory "http://mysite/download/deFormatClipBrd.zip" and when I click on a link with the number of downloads, and offers me the way "http:/mysite/cs/admin/reports/pubdlcnt/counter/deFormatClipBrd.zip".
The correct way is to be "http://mysite/admin/reports/pubdlcnt/counter/deFormatClipBrd.zip".
When I click on the link to the topic, so I offer "http://mysite/cs/node/28" and the right way to be "http://mysite/deFormatClipBrd".
Where is the mistake. The program probably does not read path from the database, but it takes anywhere from a node, which is a mistake.
English Sorry, I'm from the Czech Republic.
Top downloads by "name" instead of filename?
Is it possible to have the top downloads block display the node name or some other custom input besides the file name with all the dashes?
respond
Various people in all countries take the loans in different creditors, because that's comfortable.