Sumit Rathore
Sumit Rathore

Reputation: 571

How to display(not download) files on a webpage in php?

I am showing a list of files on a webpage. Files may be of any type like pdf,doc,excel,txt etc. What i want is when some one click on an item of the list then that file should be displayed in another tab. I dont want to download the file. I just want them to be visible so that user can read it. I try this using php for pdf files i am able to get the plain content of the file but i want a viewer type of thing. Can i achieve this? If yes can i achieve this in php? If yes then how?

Thanks and Regards Sumit Rathore

Upvotes: 0

Views: 369

Answers (2)

Sumit Rathore
Sumit Rathore

Reputation: 571

    <html>
        <body>
            <embed src="www.dedoimedo.com-apache-web-server-lm.pdf">
        </body>
    </html>

This code is working in google chrome but not in other browsers.

Upvotes: 0

hesam jaferi
hesam jaferi

Reputation: 54

downloading or viewing any file in browser depends on browser setting.

for example in firefox in Options - > Applications Tab you can change state of reading a file that can be downloading or viewing.

now, for display a file to visitor best solution is creating a special php or flash app.

Good Luck.

see http://view.samurajdata.se/

Upvotes: 1

Related Questions