PHP
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists PHP

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old July 16th, 2008, 08:21 PM
robert mena
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Corrupted ZIP files (downloaded via a php script) : Internext Explorer 7

Hi,

I have a set of files stored in a directory and I need to serve those via a
php script (in order to protect, control access etc).

The problem is that zip files (exe also) get corrupted when I try from IE7.
I've read the posts from this list and google etc with no idea of how to
solve it.

The stored files are ok (tested from firefox or direct copy). When I use
IE7 the file size is smaller. In my test a config.zip with 248 bytes ends
up with 214 bytes.

This is the code used

header("Pragma: public");
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: ".$type);

if($remove_date_from_file == false)
header('Content-Disposition: attachment;
filename="'.basename($file).'"');
else
{
$name_ = substr(basename($file),0,strrpos(basename($file),"."));
$ext_ = substr(basename($file),strrpos(basename($file),"."));
$new_name_ = substr($name_,0,strlen($name_)-15).$ext_;
header('Content-Disposition: attachment;
filename="'.$new_name_.'"');
}
header("Content-Transfer-Encoding: binary");
header('Content-Length: '.filesize($file));
while(!feof($fp))
{
echo fgets($fp) ;
}
fclose($fp);

I've added a debug to send me a message with the header and it comes the
same way no matter what browser.


Pragma: public

Expires: Wed, 16 Jul 2008 23:12:00 GMT

Cache-Control: must-revalidate, post-check=0, pre-check=0

Cache-Control: private

Content-Type: application/zip

Content-Disposition: attachment; filename="config.zip"

Content-Transfer-Encoding: binary

Content-Length: 248

Am I doing something wrong or do I have to start looking to the server's
configuration (like mod_deflate)?

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists PHP > Corrupted ZIP files (downloaded via a php script) : Internext Explorer 7


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
Stay green...Green IT