[Plugin: WP Download Codes] Download stop at 21mb
-
The new update seems to stop at 21mb no matter what.
It worked on a 89MB download until I updated today.Thanks for a great plugin btw.
??
-
Hm, we did actually just change something in the download form which in no way affects the way how files are streamed to the browser for download.
Maybe you experience a side effect from another change on the server?
Anyway, you could also try to revert back to version 2.0 and see if it’s working.
Reverted back to version 2.0 but still no joy, and then back again but still stops at 21MB.
Files over 21MB will download when not routed through the plugin, ie a direct link on pagesent a ticket to host to make sure everything the same…
any other suggestions?
thanks
Hello again.
Update.
I reinstalled 2.0 and then back to 2.1 again and it killed all my codes and file references, and still topped out at 21MB. Stupidly I didn’t have a bak up of WP-Download Codes data. It’s not hidden in an sql table is it?
Still waiting to hear from host.Cheers
Stop using WP Super Cache and W3 Total Cache and use these two instead:
DB Cache Reloaded
and
Hyper CacheOnce I did that, my downloads started to work properly.
Hi
I have a smilar problem.
Installed WP Download Codes and it works fine with files less than 1MB.
For bigger files downloading is not completed
43MB file always stops at 13MBWhat can I do?
Thanks
Hi
I forgot to tell that my files are zip files^ I’m having the same problem. using current version 2.1, and have tried guerilladigital’s suggestion to no avail.
I’m trying to run large .zip files, anywhere between 40 and 400mb. There’s no problem with the files when being uploaded, as when i use a direct link they download fine. It’s only when downloaded through the plugin that the .zip file comes out broken.
Any suggestions?
We are having the same problem. The .zip files all truncate to 12,583,259 bytes on download.
Perhaps there is an interaction with the new WordPress core update? I was looking at the changelog and the new version has some commits in areas that might affect the plugin. Maybe looking at a diff between 3.3.2 and 3.4.1 (we skipped 3.4.0) might help.
Unfortunately, I am not familiar with the WP core, and due to some urgencies I currently don’t have the capacity to look deeper into that. Could you try to point out what the changes could be? Actually, my plugin works simple as hell, it just streams the bytes for download to the client, there is nearly no more magic behind it, and I don’t know why the WP core should stop that byte stream at 12,xxx,xxx bytes.
OK, a colleague and I looked at it and the output buffer was not being flushed, creating a memory leak. I don’t know why it didn’t reach the memory limit before.
Just add
ob_end_flush();
to line 141 of the dc_template.php, right after the initial flush() call.
For clarity’s sake, in case a less experienced person wants to make the change himself:
/** * Sends headers to redirect to dc_download.php when download code was entered successfully. */ function dc_headers() { global $wpdb; if (isset( $_GET['lease'] )) { // Set timeout set_time_limit( 1200 ); // Get details for code and release $release = $wpdb->get_row( "SELECT r.*, c.ID as code, c.code_prefix, c.code_suffix FROM " . dc_tbl_releases() . " r INNER JOIN " . dc_tbl_codes() ." c ON c.release = r.ID WHERE MD5(CONCAT('wp-dl-hash',c.ID)) = '" . $_GET['lease'] . "'" ); // Get # of downloads with this code $downloads = $wpdb->get_row( "SELECT COUNT(*) AS downloads FROM " . dc_tbl_downloads() . " WHERE code= " . $release->code ); // Start download if maximum of allowed downloads is not reached if ($downloads->downloads < $release->allowed_downloads) { // Get current IP $IP = $_SERVER['REMOTE_ADDR']; // Insert download in downloads table $wpdb->insert( dc_tbl_downloads(), array( 'code' => $release->code, 'IP' => $IP), array( '%d', '%s') ); // Send headers for download header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=\"" . $release->filename . "\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize( dc_file_location() . $release->filename )); flush(); ob_end_flush(); // Stream file $handle = fopen( dc_file_location() . $release->filename, 'rb' ); $chunksize = 1*(1024*1024); $buffer = ''; if ($handle === false) { exit; } while (!feof($handle)) { $buffer = fread($handle, $chunksize); echo $buffer; flush(); } // Close file fclose($handle); } }
Thank you for the hint! Actually, I don’t know why I missed the ob_end_flush() during the implementation, there must be a reason why I have not added the function. Anyway, once I will be back from current travel, i.e. in September, I will try and update the plugin accordingly.
Hi, I added ob_end_flush(); in the file dc_template.php as allolex
suggested, but the situation is the same.Tried to download a 46MB file and it stopped at 3 or 4MB.
Is there anithing else to do after editing the file?
@gleon You said before it was always stopping at 13MB. If it’s now varying between 3 and 4MB, then there is likely another cause—perhaps in addition to the object buffer not being flushed.
Try raising your memory limit for PHP and see if that changes anything. Also, look at your web server error logs (e.g. apache, nginx) and see if there are any clues in there.
How do I raise memory limit for PHP?
My blog is in a rented hosting and I donn’t know how to check web server error logs.
By the way, in July my blog was changed to another server by my hosting due technical failures. But the problem continues the same: downloads stop any time
- The topic ‘[Plugin: WP Download Codes] Download stop at 21mb’ is closed to new replies.