Jump to content

downloading problems


grejon04

Recommended Posts

I've revised a test piece of code to narrow out some other variables.

This downloads a .doc file that is filled with gibberish, the text somewhere in the middle of it. Word asks me which encoding method I'm using. I tried turning SSL off and that did nothing.

 

MacOSX Apache server, php 5.2. something.

 

Any ideas on what could be messing up my file? I know they're ok on the server.

<?php

require_once 'includes/securitycheck.inc';
require_once 'includes/dbconnect.inc';
require_once "includes/manuscript_functions.inc";
require_once "includes/functions.inc";

	$title = "testdocument";

	//header('Vary: User-Agent'); Do I need this? Does Apace add a header of some sort?

	header('Content-Description: File Transfer');
	header("Pragma: public");
	header("Expires: 0");
	header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

	header('Content-Type: application/msword');//I tried force-download here, and it did nothing		
	   	
	header("Content-Transfer-Encoding: binary");
	header('Content-Length: ' . filesize("/u/staff/jrme/jrme_files/manuscripts/07322o.doc"));

	header("Content-Disposition: attachment; filename=" . $title . ".doc");//maybe a different disposition?

readfile("/u/staff/jrme/jrme_files/manuscripts/07322o.doc");

exit();
?>

Link to comment
https://forums.phpfreaks.com/topic/63897-downloading-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.