Can I drag files from the desktop to a drop area in Firefox 3.5 and initiate an upload?

橙三吉。 提交于 2019-12-06 16:45:52

If you haven't upgraded to 3.5 yet, you can use the dragdropupload extension.

I found out that if instead of escalating privileges globally:

    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
    ...
    function doDrop(event) {
       ...
       var file = event.dataTransfer.mozGetDataAt("application/x-moz-file", 0);
       ...
    }

I escalate privileges in the function's body:

    ...
    function doDrop(event) {

       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
       ...
       var file = event.dataTransfer.mozGetDataAt("application/x-moz-file", 0);
       ...
    }

I get rid of the error you described and gain access to the nsIFile instance I was looking for.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!