Hi All
I have a folder that contains various files (pdfs, .doc, .xls, .txt) . Now i have a list of files on my page and i would like that when the file is clicked it will open within the browser (those that have plugins such as pdf or word docs)!
I'm using the following code to open it:
Where the $filename represents the direct path to the actual file, $mimetype is the mimetype of the file, $realname is the name of the file.
Now what is happening is this, when i click the file a window for downloading an activex object and the filename is the url! i cannot figure out what is wrong!
Any help will be most appreciated!
Regards
B
I have a folder that contains various files (pdfs, .doc, .xls, .txt) . Now i have a list of files on my page and i would like that when the file is clicked it will open within the browser (those that have plugins such as pdf or word docs)!
I'm using the following code to open it:
Code:
header('Content-Length: '.filesize($filename));
header('Cache-control: private');
header('Content-Type: ' . $mimetype);
header('Content-Disposition: inline; filename=' . $realname . '');
header('Last-Modified: '. date('D, j M Y G:i:s T',$modified));
readfile($filename);
Where the $filename represents the direct path to the actual file, $mimetype is the mimetype of the file, $realname is the name of the file.
Now what is happening is this, when i click the file a window for downloading an activex object and the filename is the url! i cannot figure out what is wrong!
Any help will be most appreciated!
Regards
B