Introduce yourself here! In order to avoid spam, new users must first comment on the discussion in the 'Introductions' before they become 'full members'
Download Counter plugin error
  • Igor Kromin’s Download Counter plugin doesn’t work sometimes. When a download link is clicked, an empty page is returned with no download. The counter is updated and a mail is sent, but no download. Is Igor still here, or can somebody else look at it?
  • Hi, can you explain how to replay the bug?

    What version of the plugin are you using? What version of PHP? What webserver are you using?
    Is the problem related just to one browser or file?
    Is this file large? Does it have alphanumeric characters?
  • Replaying the bug is problematic because first I have to upload a file, then the bug decides if it wants to repeat or not. I was uploading several files in the past, and the bug happened at about 10% of the cases. I wanted to report the bug earlier, too, just I was busy with other tasks.
    Plugin version is 1.3. PHP is 5.2.3. I can’t tell the name of the webserver, sorry, the service provider didn’t reveal this information (or at least I didn’t find it). The problem isn’t related to either a certain browser or a file, it had happened at several files. When I’m uploading a file and a downloader-to-be reports a problem, I’m trying to download it myself, and I fail, too.
    Most of the files reported with an error were large, yes, but some large files were properly downloadable with the plugin. As for the file name, I’ve tried to rename them to a single digit dot extension, but that didn’t help either.
    Note that accessing the files via their direct links gives proper downloads, so the files themselves are downloadable.
  • I don't think that the bug is related to memory problems, because readfile should not have any.
    I would change the content type from application/force-download to application/octet-stream, as written on readfile comments.

    You should create a "debug" version of the script which saves the log of downloads and what readfile returns (FALSE, on error, or the number of printed bytes).

    Does the problem persist when you reload the download page?
    If it does, please check your request with the console of the browser (F12 on Firefox, Chromium and derivates) in "Network" tab.

    Otherwise please send me (or post here) a link which you know doesn't work, if it happens (you was saying that sometimes the download fails on your computer, too, wasn't you?). Being able to replay the bug is unfortunately needed to resolve it.
  • Well, I’ve uploaded a fairly large file to test it. The download page is here. I’m receiving an empty page when clicking on the download link. Reloading the page doesn’t help.
    Changing to application/octet-stream doesn’t help, I’m still getting an empty page.
    Logging what readfile returns resulted in an empty file. Zero bytes long, after several attempts.
    The Network tab gives the following results:

    image


  • Your webserver is Apache 1.3.36 :-) 
    I've seen that the file is very heavy! 1.6GiB!

    I'm going to make some tests in local.
  • It seems that the server doesn't reply anything, or just \n\r, even tought it increases the download counter.

    Try to change the line 62 to:
    if(readfile($download) === FALSE) {
    die('Error downloading the file.');
    }
  • OK, change is now done, but it’s line 70 at me. Do I have a different version? It’s 1.3.
  • It doesn’t display the error message now added.
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion