cody@joasurveys
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Publication Archive] pdf's not readable on downloadThanks for the reply’s Eric!
Talked to the server people and they found no problems. No log errors were showing up for pdf downloads.
Talked to the web design company and they went through and found this:
“It looks like when the caching plugin (super cache) updated, it broke the JavaScript files concatenation. I removed that caching plugin and added a new one that’s less aggressive (quick cache). I also added a rule that prohibits the scripts concatenating, which can break them and cause things that depend on AJAX to break.”
They changed the site so that pdf’s are hyper-linked in the wp page editor to open in a new tab, not as slick as wp pub archive but gets the job done.
Thanks!
Forum: Plugins
In reply to: [WP Publication Archive] pdf's not readable on downloadSo I am over my head in all this, but still in the fight. A copy of the download link looks like this:
http://joasurveys.com/wp-content/plugins/wp-publication-archive/includes/openfile.php?file=http|joasurveys.com/wp-content/uploads/2012/11/tides1.pdf
If you cut it down to just the file location (joasurveys.com/wp-content/uploads/2012/11/tides1.pdf) it opens the pdf in the browser.
Here’s a cut and paste of the openfile.php, in case anything jumps out at you.
<?php
if ( ! isset($_GET[‘file’]) )
die();if ( strpos( $_GET[‘file’], (isset($_SERVER[‘HTTPS’]) ? ‘https|’ : ‘http|’) . $_SERVER[‘SERVER_NAME’] ) === false )
die();require_once(‘../lib/class.mimetype.php’);
$mime = new mimetype();$fPath = str_replace(‘http|’, ‘http://’, $_GET[‘file’]);
$fPath = str_replace(‘https|’, ‘https://’, $fPath);
$fType = $mime->getType( $fPath );
$fName = basename($fPath);$origname = preg_replace(‘/_#_#\d*/’,”,$fName);
$fContent = fetch_content( $fPath );
output_content( $fContent, $origname );
function fetch_content( $url ) {
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_HEADER, 0 );ob_start();
curl_exec( $ch );
curl_close( $ch );$fContent = ob_get_contents();
ob_end_clean();
return $fContent;
}function output_content( $content, $name ) {
header( “Expires: Wed, 9 Nov 1983 05:00:00 GMT” );
header( “Last-Modified: ” . gmdate(“D, d M Y H:i:s”) . ” GMT” );
header( “Content-Disposition: attachment; filename=” . $name );
header( “Content-type: application/octet-stream” );
header( “Content-Transfer-Encoding: binary” );echo $content;
}
?>Thanks for getting back to me!