November 17, 2018 at 11:11 pm #849
I saw one of the topic here, but still give it a try. At first we were excited. But after the plugin was deploy to the live site, customers who tried to download the PDF ends with Zero Bytes.
I tried to debug but no luck.
I tried also to follow your suggestion about PHP Dispatch and toggle the check box for luck, still no works.
I tried to install new fresh wordpress on my Mamp and install all your plugins, and guess what… still Zero bytes for the pdf file.
Have you tried to check it lately guys if this still working? I mean, paying you almost $30 seems not worth for this plugin…November 21, 2018 at 1:11 am #850
Let me look into this. Are you using the secure downloads addon or just the main plugin? If you are using the secure download addon then are you using the dropbox option or just uploading the PDF file directly to your site?
Can you share a link to the page where I can go and inspect the download button?November 21, 2018 at 3:14 am #851
Please watch this video i made… drive.google.com/open?id=1v3wtWJqMNVDRtCfGtxJnsHQ4ASpcLfj2
Regarding page, I will create one for you guys.November 22, 2018 at 1:19 am #852
As your suggestion, please watch the video. drive.google.com/open?id=1VBzlkoUtNUASF9mSIHmr5Pz-83fVD_rK
Actually, my theme does heave header and footer. Since it was custom theme (and fresh installed) made by me to my client, it was more optimized than the usual.November 22, 2018 at 5:48 am #855
Thank you. Your setup looks fine to me. PHP must be failing to dispatch the correct header on this site for some reason. I will take a look inside your site. Please use the contact form on the site to send me access to the site (if possible). It should help me troubleshoot this.April 12, 2019 at 3:50 am #1073
It’s been 4 and half months after I open this thread. My bad I didn’t provide yet any access to the author. However, it is bad as well that I didn’t see if they’ve manage to check this error/issue.
Anyway, upon debugging “in my case” today April 12,
readfile()is failing to give a
200 okcode to the header in-which resulting
http/1.1 403 forbiddento the attached PDF file.
Warning: readfile(http://localhost:8888/wp-content/uploads/2019/01/Brochure.pdf): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /Users/mac/Sites/sandbox/wp-content/plugins/sdm-squeeze-form/sdm-sf-shortcodes.php on line 281
Base on my findings,
readfile()throwing 403 to the pdf attachment which ending-up zero-byte. I tried to create small code inside the
$parsed = parse_url( get_post_meta($postid, ‘sdm_upload’, true) );
$url = dirname( $parsed [ ‘path’ ] ) . ‘/’ . rawurlencode( basename( $parsed[ ‘path’ ] ) );
$filePath = ABSPATH . substr($url, 1);
then I rewrite the readfile( $file ) var into
readfile( $filePath );
Overall, I am still open for some comments if they’ve manage to fix this issue. Else, i will mark this as resolved, if I can prove that the code I am using is the solution to this case.
Regards,April 12, 2019 at 5:23 am #1075
This one is a site specific issue. If the code that you are using now is working then that’s totally fine.April 17, 2019 at 10:44 am #1077
ok, so this is the final code that is completely working.
$parsed = parse_url( get_post_meta($postid, 'sdm_upload', true) ); $url = dirname( $parsed [ 'path' ] ) . '/' . rawurlencode( basename( $parsed[ 'path' ] ) ); // Combine the absolute path and the attachment url $filePath = ABSPATH . substr($url, 1); // Get the attachment file-size $size = filesize($filePath); // Temporary disable due to error // $headers = get_headers($file, 1); // $fsize = $headers['Content-Length'];
here’s the code will look like after the provision codes.
header('Content-Length: ' . $size); readfile( $filePath );
Hope this will help others.
You must be logged in to reply to this topic.