jQuery 将文件发送到 REST API 的表单
我有一个带有 enctype = "multipart / form-data"
的表单。我需要将其发送到 REST API 进行上传。服务器使用 Django 和活塞。请告诉我如何最好地做到这一点。从 JavaScript(主干)开始,将其与文件一起序列化为 JSON。或者这是不可能的?也许我需要单独上传文件,获取其 ID,然后仅通过 REST 发送它们?
I have a form with enctype = "multipart / form-data"
. I need to send it to the REST API for uploading. The server is using Django and piston. Advise me how best to do this please. As of JavaScript (backbone) to serialize it into JSON with the file. Or is this not possible? Maybe I need to separately upload files, get their ID and then send them via REST only?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以有一个插件来做到这一点,你不觉得吗?
http://lagoscript.org/jquery/upload/demo?locale=en
You can have a plugin to do it, don't you think?
http://lagoscript.org/jquery/upload/demo?locale=en