Hi! thr,

I am uploading a file in to server. At the time of downloading, it should show "view as html" as google does.

thanx in advance.

Manoj

Recommended Answers

All 5 Replies

Google Docs and HTML are two different things. Do you want a link that shows the HTML of a document or do you want a link to view the document in Google Docs?

Hi! thr,

I am uploading a file in to server. At the time of downloading, it should show "view as html" as google does.

thanx in advance.

Manoj

This is actually a complicated task. You'll need to be able to parse different file types into HTML.

For example, converting a PDF file to HTML is different from converting a word document.

You'll have to do specific parsing for each file you want to support.

Security is also an issue here. You'll probably need to scan the documents for vulnerabilities.

yes you have to write codes for different type of files in different manner.

Coulld you share any idea to do this?

Well what kind of files would you be uploading. Images? Document? Presentations? Some of these are extremely easy to view as html. For most images (except for PSD's and others that won't display in a normal browser) all you have to do is just output a simple HTML document and use the img tag to include the image in it. For non-supported formats of images, you will need to convert them to a more standard format such as PNG or JPG. This can be done simply by Googling for a php PSD to PNG converter. The same goes for any kind of document. You can find PDF to HTML converters, you can find Doc and Docx to HTML converters. All you have to do is search Google for all the file types you would like to support. I've found some of these PHP converters for you:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.