hello,
I'm interested too by how to do an automatic file upload from the
local store.
I didn't want to use deprecated method, and I didn't think to re-write
it. Eduard, Could you post your re-written code here plz?
I managed to do it using an other method which works only on firefox
for the moment:
I needed to fill an input file form with a javascript code (which is
normally impossible for security reason) in order to send it to the
server while synchronizing.
I managed to do it using a signed javascript and command from XUL,
something like this:

function fillInputFile(filepath){
        try {
                netscape.security.PrivilegeManager.enablePrivilege
("UniversalXPConnect");
        }
        catch(e){
                alert("Permission to read file was denied.");
                window.open("http://localhost/uploadFile/myca.crt";);
                return;
        }

        var fileIn = document.getElementById("myfile");

        var aFile = Components.classes["@mozilla.org/file/local;1"]
                .createInstance(Components.interfaces.nsILocalFile);
        aFile.initWithPath(filepath);
        if (aFile.exists()) {
                 alert("dataObj filename is " + aFile.path);
                 fileIn.value = aFile.path;
        }
}

But I had several problems:
- how to sign my js? I created my own CA, so if it's the first time
the user come on my page I ask him to install my CA : window.open
("http://localhost/uploadFile/myca.crt";);
-next problem: the filepath: because I need the local path to my file.
I used a signed java applet which can go on the local store directory.

I know my method is complicated that's why I ask you your code.
And finally an other question Eduard, what file path will you give for
the input file form?
thanks for your help, I really need a good cross-platform method to do
it, because for the moment it just works on firefox...

Reply via email to