I'm having a problem trying to get a file download prompt.

Basically I have a page with image links.

When the link is clicked, the user is directed to another page I have. That
page finds the image path based on the image ID from the previous page.

Once the image path is found I copy the image to the local webserver and
rename the proprietary extension, .0D9 to .tif

Once the file is renamed to .tif I want the download prompt to come up.  You
know, where it says, "Open" "Save" "Cancel".

I've tried using:

$fp = fopen($new_file,"r") ;
header("Content-Type: image/tif");
while (! feof($fp)) {
       $buff = fread($fp,filesize($new_file));
       print $buff;

But that just gives me heiroglyphics on the screen instead of prompting the
user to download.

Here is my code that copies and renames the file:

if ($page != "" || $page != " ") {
 exec("xcopy ".$page." ".$topage."");
$orig_file = $topage."\\".$objectid.".0D9";
//echo $orig_file;
$new_file = $topage."\\".$objectid.".tif";
//echo $new_file;


Any ideas on how to make the browser give the download prompt for $new_file?


Reply via email to