使用 Javascript 上传文件,无需用户干预 [英] File upload with Javascript without user intervention

查看:23
本文介绍了使用 Javascript 上传文件,无需用户干预的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于 PDF 签名的 Firefox 组件,我通过 Javascript 调用它.问题是该组件将签名的 PDF 输出为用户文件系统上的文件 - 无法获取字节 []、流或类似内容.

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.

我需要将此签名的 PDF 文件发回服务器.是否可以在纯 Javascript 中做到这一点,而无需额外的 Firefox 组件?

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?

推荐答案

你不能在没有干预的情况下做到这一点,这将是一个巨大的安全漏洞.想想访问一个网页,它能够在您不做任何事情的情况下抓取和上传您的任何文件......您可以看到这将如何被滥用真的快.

You can't do this without under 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.

您也许可以使用 Firefox 扩展来做到这一点,我不确定它施加的安全限制(尽管如果它也不允许这样做我不会感到惊讶),但 JavaScript 在这里不是一个选项.

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.

这篇关于使用 Javascript 上传文件,无需用户干预的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆