Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Downloading a file through PHP works in firefox, not IE

Status
Not open for further replies.

danno74

IS-IT--Management
Nov 13, 2002
295
US
Greetings,

I have the following code on my software download page to assure that no one can download the software w/o correct authentication:

Code:
<?php
session_start();

if (isset($_SESSION['fullname']))
{
      //Location of file, must be out of web root
      $file_location='/downloads/FileZilla_2_2_7c_setup.exe';
      
      //open file
      $file=fopen($file_location,'r');
      
      //get file size
      $file_size=filesize($file_location);
      
      //read the file
      $content=fread($file,$file_size);
      
      //close the file
      fclose($file);
	  
      //supply the right file format      
      header('Content-type: application/exe');
      
      //force browser to prompt to download file
      //cool option of this header is that allows you to rename the file
      header('Content-Disposition: attachment; filename="FileZilla_2_2_7c_setup.exe"');
	
      
      //finally echo content
      echo $content;
}
else
{
header("Location: [URL unfurl="true"]https://www");[/URL]
}

        
?>

Works in FF, not IE. When i try it in IE, it states the following:

"IE cannot download title2.php from www. IE was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."

Any ideas? Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top