查看PDF和Doc文件没有下载它们 [英] View PDF & Doc Files Without Downloading them

查看:88
本文介绍了查看PDF和Doc文件没有下载它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我已经能够在这篇文章中使用这段代码使用php将文件上传到MySQL数据库,它运行良好。


但现在我希望能够让用户只需查看PDF或doc文件而无需下载它们。


我需要帮助。


谢谢

Hello guys,

I have been able to work on this code in this article uploading files into MySQL database using php and it is working well.

But now I want to be able to allow users just view the PDF or doc files without having to download them.

Please I need help on this.

Thanks

推荐答案

你好Abramfas,


这取决于浏览器。


如果浏览器知道如何打开文件,那么它会这样做。如果浏览器不知道该怎么做,它将为用户提供下载文件的选项,以便他们可以在知道如何打开它的应用程序中打开该文件。


例如,如果浏览器安装了允许用户查看PDF文件的插件,则会使用该插件显示该文件。如果浏览器没有安装插件,它将弹出一个对话框,让用户将文件保存到他们的计算机上,这样他们就可以使用知道如何查看PDF文件的应用程序打开它。


如果您想在与您的内容相同的页面上显示该文件,请考虑使用< iframe> 谁指向您希望的PDF文件用户视图。这样浏览器将使用适当的插件显示文件,否则将提示用户下载文件。


如果你是的话,你也可以打开一个新窗口不习惯使用< iframe> s。


-Frinny
Hi Abramfas,

This is going to depend on the browser.

If the browser knows how to open the file, then it will do so. If the browser does not know what to do it will give the user the option to download the file so that they can open the file in an application that does know how to open it.

For example, if the browser has a plug-in installed that allows users to view PDF files, it will use the plugin to display the file. If the browser does not have a plugin installed, it will popup a dialog that lets the user save the file to their computer so they can open it with an application that knows how to view PDF files.

If you want to display the file on the same page as your content, consider using an <iframe> who points to the PDF file that you wish to let the user view. This way the browser will display the file using the appropriate plugin if it can, or else the user will be prompted to download the file.

You could also open a new window if you are not comfortable using <iframe>s.


-Frinny


Abramfas,


您是否试图模仿Google邮件对附加文档的处理效果,将其呈现为HTML?或者,您是否只是尝试使用插件显示完整文档,如Frinny所描述的那样?


- 合作
Abramfas,

Are you trying to emulate what google mail does with attached documents, rendering them as HTML? Or, are you simply trying to display the full-document using a plug-in, as Frinny described?

--Oralloy


口头,


我试图用插件显示完整的文档。


Frinavale,


如何在php编程中插入iframe有点新的
Orally,

I am trying to display the full document with a plugin.

Frinavale,

How do I insert an iframe am a bit new in php programing


这篇关于查看PDF和Doc文件没有下载它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆