File Upload With Javascript In Chrome Or Firefox Extension Without User Intervention
Solution 1:
if you are uploading from the clients computer, you can't. Its a security feature of file.upload. If you examine the path to the uploaded file, you'll notice c://fakepath/xxxxx this is to prevent applications finding out file structure on the clients computer.
https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications
Solution 2:
In Firefox add-ons (well, in the privileged parts, i.e. not SDK page-mods and so on), you can construct a file object you could use with the regular HTML5 stuff (XMLHttpRequest
, FormData
;)) directly via the File
"constructor":
var file = File("path/to/some/file");
When it comes to Chrome you're out of luck as @David already correctly pointed out in the other answer.
Edit 1:
Actually, when it comes to chrome it might be possible to request a file://*
permission, have the user opt-in explicitly, and then use xhr
etc. to first retrieve the file as a blob and then upload the blob with another xhr
. Haven't tested this, though.
Post a Comment for "File Upload With Javascript In Chrome Or Firefox Extension Without User Intervention"