views:

67

answers:

2

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.

A: 

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.

Rook
+1  A: 

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);
Knife-Action-Jesus