Trusted Folder/Drive Picker in the Browser

Posted by kylepfritz on Stack Overflow See other posts from Stack Overflow or by kylepfritz
Published on 2010-03-16T15:30:37Z Indexed on 2010/03/16 15:31 UTC
Read the original article Hit count: 252

Filed under:
|
|

I'd like to write a Folder/Drive picker the runs in the browser and allows a user to select files to upload to a webservice. The primary usage would be selecting folders or a whole CD and uploading them to the web with their directory structure in tact. I'm imagining something akin to Jumploader but which automatically enumerates external drives and CDs. I remember a version of Facebook's picture uploader that could do this sort of enumeration and was java-based but it has since been replaced by a much slicker plugin-based architecture.

Because the application needs to run at very high trust, I think I'm limited to old-school java applets. Is there another alternative? I'm hesitant to start down the plugin route because of the necessity of writing one for both IE and Mozilla at a minimum. Are there good places to get started there?

On the applet front, I built a clunky prototype to demonstrate that I can enumerate devices and list files. It runs fine in the applet viewer but I don't think I have the security settings configured correctly for it to run in the browser at full trust. Currently I don't get any drives back when I run it in the browser.

Applet Prototype:

public class Loader extends javax.swing.JApplet {

...

   private void EnumerateDrives(java.awt.event.ActionEvent evt) {  
       File[] roots = File.listRoots();
       StringBuilder b = new StringBuilder();
       for (File root : roots) {
          b.append(root.getAbsolutePath() + ", ");
       }
       jLabel.setText(b.toString());
   }

}

Embed Html:

<p>Loader:</p>
<script src="http://www.java.com/js/deployJava.js"
type="text/javascript" ></script>
<script> 
  var attributes = {code:'org.exampl.Loader.Loader.class',

archive:'Loader/dist/Loader.jar', width:600, height:400} ; var parameters = {}; deployJava.runApplet(attributes, parameters, '1.6');

© Stack Overflow or respective owner

Related posts about applet

Related posts about fileupload