最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

File upload with Javascript without user intervention - Stack Overflow

programmeradmin1浏览0评论

I have a Firefox ponent for PDF signing that I invoke via Javascript. The problem is that this ponent 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 ponents?

I have a Firefox ponent for PDF signing that I invoke via Javascript. The problem is that this ponent 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 ponents?

Share Improve this question asked Jun 10, 2010 at 13:08 daspdasp 9074 gold badges14 silver badges21 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

You can't do this without user intervention, this would he a huge security 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.

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.

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 ponent 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.

发布评论

评论列表(0)

  1. 暂无评论