Strange Download-File Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ave,

I created a multi-user File Management program written in PHP with mySQL
backend. Basically it allows registered users to upload files to their or
other users accounts, and allows them to download files.

I use the force-download for my download process.

Here's the problem.

When someone clicks on the download link for a file, the Save Dialog box
opens, giving user the choice to either "OPEN" the file or "SAVE" the file
to a particular location.

The problem is.. If you SAVE the file to any location.. It works fine. You
can go and open the file from that location. However, if you choose "Open"
from the Dialog Box... The associated application for the file type does
open.. But the file doesn't open.. It gives an error.

Why is that?

Here's the Download Script I use (imsafm2_download.php):

<?php session_start(); ?>
<?php
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($F));
@readfile($F);
?>            

And here's the php code for the link which downloads the file:

<a 
href=\"imsafm2_download.php?F=imsafm/$showfilesuser/$myrow[filename]\"><img
src=b_newtbl.png border=0></a>

Any help appreciated.

Rahul S. Johari


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux