Hi all

I am using the following to pass a file to the client

<snip>
header("Content-type:  ". $row['filetype'] );
$path = ROOT_PATH . "file_uploads/";
$real_filename = $path . $row['location'] . '/' .$row['filename'];
header("Content-Disposition: attachment; filename= " . $row['filename']);
readfile($real_filename);
</snip>

The content type is obtained from a database along with the actual location
of the file. The files are outside of the webroot.

The problem is that the file is either corrupted or something different is
sent.

E.g. if a pdf is sent the first line of the received file is 

%PDF-1.3 followed by some unprintable (in a 7 bit email) characters, this
causes adobe to report an error.

If a text file is downloaded, then all I get is the source of the webpage I
called the function from.

Where am I going wrong?

I have checked the pathnames and the headers and all seems to be correct.
The browser produces a dialog with the correct information in it, i.e what
file type and the name.

Thanks

Alastair


****************************************************************************
This email and any attached files are confidential and intended
solely for the use of the individual/s or entity to whom it is
addressed. If you have received this email in error please notify:-
[EMAIL PROTECTED]

RACAL INSTRUMENTS WIRELESS SOLUTIONS.
An AEROFLEX Company. Visit our website at:-
http://www.racalinstruments.com/

This footnote also confirms that this email message has
been swept for the presence of computer viruses.
****************************************************************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to