Jump to content


Problem with headers


  • Please log in to reply
No replies to this topic

#1 Maynard

Maynard

    Coder

  • Members
  • PipPipPipPipPip
  • 108 posts
  • Location:Finland
  • Real Name:Jarmo
  • IPB Version:v3.2.x

Posted 28 February 2011 - 06:30 PM

I'm having problems transferring a code into ip.content. The page works fine outside the ip.content environment but I'm getting errors when run from ip.content.


The problematic part of the code seems to be:

// send the zip file to the user

header('Content-Description: File Transfer');
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename='.$zipname);
header('Content-Transfer-Encoding: binary');
//header('Expires: 0');
//header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
//header('Pragma: public');
//header('Content-Length: '.filesize($ziplocation));
ob_clean();
flush();
readfile($ziplocation);
unlink($ziplocation);
?>

I had to comment out the last 4 header lines for it to work at all.  Now I get the file and most archive programs open it but there is still errors in the beginning of the zip file.

<b>Warning</b>:  Cannot modify header information - headers already sent in
<b>/var/www/board/admin/sources/classes/output/formats/html/htmlOutput.php</b> on line <b>109</b><br />

The error repeats on lines 109, 120, 129, 130 and 134 depending on what lines are commented on the code. Turning off HTTP headers still produce the errors.

How do I need to change the code to work from within ip.content?

The complete code:

Spoiler





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users