views:

97

answers:

3

I have a Firefox component for PDF signing that I invoke via Javascript. The problem is that this component outputs the signed PDF as a file on the user's filesystem - there is no way to get a byte[], stream or similar.

I need to post this signed PDF file back to the server. Is it possible to do this in plain Javascript, without additional Firefox components?

+2  A: 

You can't do this without under intervention, this would he a huge surity hole. Think about visiting a webpage and it being able to grab and upload any of your files without you doing a thing...you can see how this would be abused really fast.

You might be able to do this with a Firefox extension, I'm not sure of the security limitations it imposes (though I wouldn't be surprised if it disallowed this as well), but JavaScript would not be an option here.

Nick Craver
+1  A: 

There's no direct way to access data on a user's file system within a browser unless you're doing it through an extension. This would be a huge security risk.

If the file can be put into an <input type="file" /> element in Firefox, you can use JavaScript to automatically upload the data to the server without user intervention, but you would need something to initially get the file into the page's memory, not the file system.

Dan Herbert
A: 

Hell no - And for very good reason. You wouldn't want every Tom, Dick and Harry automatically grabbing all your files.

I believe it's the file input that needs user interaction. You can post the form automatically but you can't fill it in.

IMO your best bet is replacing the whole Firefox component with a single Java applet - I'd all but guarantee there's a Java project for PDF signing. Perhaps even Flash or Silverlight as long as you can do what you need with your PDF.

Oli
Why so sexist? Jane is perfectly capable of abusing the hell out of this too :)
Nick Craver
;) Jane's too busy cracking your WEP key.
Oli