pzbrawl Posted January 18, 2007 Share Posted January 18, 2007 This code, run from a shared linux/apache web server, fails at the end of the download with a "source file could not be read" error at the client.[code=php:0] $path = "xxx/"; $file = "yyy.zip"; $filetype = "application/x-zip-compressed"; $fsize = filesize( $path . $file ); header( "Content-Disposition: attachment; filename=\"$file\""); header( 'Content-type: '. $filetype ); header("Content-Length: $fsize" ); header( 'Pragma: no-cache' ); header( 'Expires: 0' ); return @readfile( $path . $file );[/code]When the content-length header is not sent, some users can download successfully while others get incomplete zips.Setting type to "application/octet-stream" or "encoding/x-compress" yields the same result.Setting type to "application/gzip" gets rid of the read error when length is set but still yields an invalid zip.Could anyone please suggest what might be going on? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.