Php msword and pdf browsing and downloading how to implement the younger brother is doing a teacher to publish the thesis requirements, and then the students upload the thesis website, is a graduation assignment, the teacher has a holiday, can't ask, so I came to you. my website only allows students to upload pdf or msword files and download them, except downlaod. in addition to php, when clicking the File link, the instructor does not necessarily download the file immediately, but opens a browser interface. you can choose to view the file online or download it if necessary, how can I download msword and pdf files in php?
The younger brother is working as a teacher to publish a thesis request, and then the students upload the thesis website, which is a graduation assignment. the teacher has a holiday and can't ask, so he will come to you.
My website only allows students to upload pdf or msword files, which can be downloaded, except downlaod. in addition to php, when clicking the File link, the instructor does not necessarily download the file immediately, but opens a browser interface. you can choose to view the file online or download it if necessary, how can this problem be achieved .... Or is it implemented using js?
------ Solution --------------------
Not very well controlled. Set the header to the browser.
Http://www.cnblogs.com/persy_php/archive/2010/07/21/1782407.html
Http://grow.sinaapp.com /? P = 667
Set the header, similar to the following
Header ('content-Description: File Transfer ');
Header ('content-Type: application/octet-stream ');
Header ('content-Disposition: attachment; filename = '. basename ($ file ));
Header ('content-Transfer-Encoding: binary ');
Header ('content-type: application/pdf ');
Header ('content-Disposition: attachment; filename = "downloaded.pdf "');
Readfile('original ');