没有获取文件的完整路径来检查pdf是否受密码保护 [英] not getting file full path for checking pdf is password protected or not

查看:130
本文介绍了没有获取文件的完整路径来检查pdf是否受密码保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,





我需要检查pdf是否受密码保护。因为我确实喜欢





Hi All,


I need to check whether pdf is password protected or not. for that I did like


try
{
    PdfReader pdfReader = new PdfReader(pdfFullname);
    return false;
}
catch (BadPasswordException)
{
    return true;
}





这里pdfFullname将作为test.pdf出现。但在IE中我正在走完全路。但在firefox和chrome中只有文件名即将到来。

此处异常将以test.pdf作为文件或资源找不到。



请给它输入。



here pdfFullname is coming as test.pdf. but in IE am getting the full path. but in firefox and chrome only file name is coming.
here exception will come as test.pdf not found as file or resource.

please give input for it.

推荐答案

您不需要浏览器的完整文件路径。该文件正在上传到服务器,因此您只需要文件名。路径的其余部分将是处理上载时服务器端代码放置文件的文件夹的路径。



不,您的代码无法在客户端计算机上看到该文件,也无法尝试加载该文件的副本。
You don't need the full file path from the browser. The file is being uploaded to the server so all you need is the filename. The rest of the path is going to be whatever the path is to the folder where your server side code put the file when it processed the uploads.

No, your code can NOT see the file on the clients machine and can NOT try and load that copy of the file.


这篇关于没有获取文件的完整路径来检查pdf是否受密码保护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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