小程序无法从网络驱动器访问文件

发布于 2024-08-21 14:29:00 字数 151 浏览 5 评论 0原文

使用我签名的小程序的用户之一无法从他的网络驱动器上传文件(基本上无法访问驱动器),而使用我签名的小程序的其他用户很少能够从网络驱动器访问和上传文件。我可以知道背后的原因是什么吗?

注意:无法从网络驱动器访问文件的用户,他可以手动从网络驱动器访问文件并能够复制到本地驱动器。

one of the users who is using my signed applet is unable to upload the file (basically unable to access the drive) from his netwrok drive and few of the other users who are using my signed applet able to access and upload the files from network drive. can i know what could be the reasons behind ?

Note : user who is not able access the file from network drive, he is able to access the file from network drive manually and able to copy to his local drive.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

似狗非友 2024-08-28 14:29:00

确保将代码包装在特权块中,否则您的签名并不重要。

您可以使用类似的方法来读取文件。

      File inputFile = (File) AccessController.doPrivileged(new PrivilegedAction() {
      public Object run() 
      {
         File inputFile1 = new File("C:\\Program Files\\MyFolder\\MyFile.jpg");
         return inputFile1;
      }
      });

  FileReader in = new FileReader(inputFile);

如果您想使用变量而不是静态文本作为文件位置,则必须使用这样的最终变量。

final String myfilename = <path or string var of filename>
File inputFile = (File) AccessController.doPrivileged(new PrivilegedAction() {
      public Object run() 
      {
         File inputFile1 = new File(myfilename);
      }
    }};
FileReader in = new FileReader(inputFile);

Make sure your wrapping the code in a privileged block or else the fact that your signing it won't matter.

You can use something like this to read in a file.

      File inputFile = (File) AccessController.doPrivileged(new PrivilegedAction() {
      public Object run() 
      {
         File inputFile1 = new File("C:\\Program Files\\MyFolder\\MyFile.jpg");
         return inputFile1;
      }
      });

  FileReader in = new FileReader(inputFile);

if you want to use a variable and not static text as the file location you have to use a final variable like this.

final String myfilename = <path or string var of filename>
File inputFile = (File) AccessController.doPrivileged(new PrivilegedAction() {
      public Object run() 
      {
         File inputFile1 = new File(myfilename);
      }
    }};
FileReader in = new FileReader(inputFile);
靖瑶 2024-08-28 14:29:00

签署小程序并不一定能绕过所有安全限制,如果是这种情况,那么犯罪分子就会签署他们的漏洞。在授予小程序访问权限之前,用户仍然必须信任该证书。我会确保小程序可以读取/写入 本地驱动器,因为我怀疑这也是禁区。

Signing the applet doesn't necessarily bypass all secuirty restrictions, if this where the case then criminals would sign their exploits. The user still has to trust the certificate before the applet is given access. I would make sure that the applet can read/write to the local drive, because I suspect that this is also off limits.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文