aronnebrivio / OpenPGP

Webapp to encrypt-decrypt with PGP for FirefoxOS
GNU General Public License v3.0
10 stars 2 forks source link

Unable to search for a local file on PC #12

Open aronnebrivio opened 9 years ago

giuscri commented 9 years ago

I'm not sure to understand where the problem is, but if you're expecting to traverse the file system without asking anything to the user, this is very unlikely to consist in a bug.

To my knowledge, there exists neither an API for doing that nor any assumption you can do that: except you exploit a vulnerability in the browser's sandboxing, you won't be able to access the file system from client-side javascript.

What you can do is to let the user itself to provide the file to the browser — both by a dialog or a drag-and-drop'able box in the HTML. From then on, you can use the File API (that is not deprecated anymore, apparently).

If you don't feel like a ninja on the topic, and the W3C draft is of no help, you can check this post on Google's Html5 Rocks that I used when I got stuck on the File stuff.

aronnebrivio commented 9 years ago

The problem was the user needs to choose a file from PC to import a private/public key and finder.js doesn't work except for Firefox OS.. I solved using an if the app is running on a non-Firefox OS platform.. Another solution would be the drag-and-drop, I'm taking a look to it :)