AJAX post 模拟输入类型=“文件”小路
我想知道是否可以发出 AJAX post 请求来提交表单的文件路径。基本上,我想知道是否可以模拟普通输入 type="file" 将创建的路径,但在 AJAX 请求中。另外,该链接是否可能指向另一个网站上的文件?
我想我别无选择,因为我无法访问服务器端脚本(PHP),这是因为我想创建的是greasemonkey脚本(用户脚本)。
感谢您的回答。
I would like to know if its possible to make an AJAX post request to submit a file path to a form. Basically, I want to know if its possible to simulate the path a normal input type="file" would create, but in an AJAX request. Also, is it possible for that link to be pointing to a file on another website?
I think I have no other choice since I don't have access to server-side scripts (PHP), and that is because what I want to create is a greasemonkey script (userscript).
Thanks for answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Javascript/jQuery 只能帮助您将请求发送到服务器,但您将需要服务器端语言来实际上传文件。否则这是不可能的。
不过,请查看 jQuery 表单插件。
Javascript/jQuery can only help you to send the request to server but you will need the server-side language to actually upload the file. It is not possible otherwise.
However, have a look at jQuery Form Plugin.