Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display most used file extensions (pdf, doc, docx, xls, ...) into a browser using PHP?

Tags:

file

php

Currently developping a mobile webmail for my school, I am encountering the iPhone problem : iPhone users are enable to download files, so I would like to allow them, at least, to consult their files with the common extensions : doc, docx, xls, xlsx, pdf, ppt, pptx, XML, open office files, an so on.

Does something exist to do that using PHP or HTML/Javascript ?

like image 296
Alexandre Bourdin Avatar asked Jan 26 '11 10:01

Alexandre Bourdin


1 Answers

You could use google doc's viewer: http://docs.google.com/viewer

This will allow you to display all of these formats directly in the browser.

Basically you just have to do this to display a document:

<iframe src="http://docs.google.com/viewer?url=<?=urlencode($document_url)?>&embedded=true" width="600" height="780" style="border: none;"></iframe>

(Note that google docs must have access to these documents, which may or may not make this solution unsuitable.)

like image 190
Arnaud Le Blanc Avatar answered Sep 23 '22 21:09

Arnaud Le Blanc