如何打开本地c驱动器中的pdf文件 [英] How to open a pdf file located in a local c drive

查看:124
本文介绍了如何打开本地c驱动器中的pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我和我的两个同事在我们的计算机上都有一个文件夹:C:\ Synkade filer.因此,任何存在的文件,我们所有人都可以访问.

Background: Me and my two colleagues all have a folder on ours computer called: C:\Synkade filer. So any file that is there, we all have access to.

现在,我已经创建了一个小型MySQL数据库,用于将路径保存到该本地文件夹中的文件,例如 C:\ Synkade filer \ pdffiles \ file1.pdf

Now I have created a small MySQL database that saves the path to a file on that local folder, for instance C:\Synkade filer\pdffiles\file1.pdf

我制作的php脚本在将新文件上传到 * C:\ Synkade filer \ pdffiles *,然后将路径信息保存到MySQL中. 这个想法是,当我单击一个小的pdf-icon时,php脚本将从MySQL获取路径信息,并在浏览器(firefox)上打开文件. 假设MYSQL中的路径信息为: C://Synkade filer/pdffiles/file1.pdf 检索代码为:

The php script I made has no problem in uploading new files into the *C:\Synkade filer\pdffiles* and saving the path information into MySQL. The idea is that when I click on a small pdf-icon the php script will get the path information from MySQL and open the file on the browser (firefox). Say the path information in MYSQL is: C://Synkade filer/pdffiles/file1.pdf The retrieving code is:

<a href="' . $row['fup']. '"><img src="./images/pdf_icon.gif" width="16" height="16" border="0" alt="PDF file" /></a>

,其中 $ row ['fup'] 是来自MySQL的行信息.

, where $row['fup'] is the row information from MySQL.

问题是这不起作用.是因为文件位于本地驱动器(C :)上?

The problem is that this doesn’t work. Is it because the file is on a local drive (C:)?

在您问:为什么不将文件上传到我的Web服务器上?答案是我不想这样做. pdf文件确实具有敏感信息,我们三个仅显示这些信息可以访问.因此,最好只在我们自己的计算机上访问pdf文件.重点还在于,如果其他人尝试打开pdf文件,由于它在他/她的设备上不存在,将很容易找不到它.

Before you ask: why not upload the files on my web server? The answer is that I would prefer not to. The pdf files do have sensitive information that we three only show have access to. So it feels better that the pdf files are only accessible to us on our own computers. The point is also that if someone else tries to open the pdf file, it simple will not find it since it will not exist on his/hers device.

所以我的问题是:有没有办法使从本地驱动器对文件的访问起作用.这是脚本问题还是计算机配置问题?

So my question is: Is there a way to make the access to the files from a local drive to work. Is this a script problem or is this a computer configuration issue?

我需要说的是,这是我有史以来第一个PHP-MySQL数据库,因此我的知识有限.我很感谢我能得到的任何帮助.

I need to say that this is my first PHP-MySQL database ever, so my knowledge is limited. I am thankful for any help I can get.

推荐答案

在文件路径前使用file:///.

Use file:/// in front of the path of your file.

http://www.w3schools.com/html/html_url.asp

例如:

<a href="file:///' . $row['fup']. '"><img src="./images/pdf_icon.gif" width="16" height="16" border="0" alt="PDF file" /></a>

这篇关于如何打开本地c驱动器中的pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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