如何使用 Carrierwave、Backbone、Plupload 将异步文件上传附加到模型?
我正在努力实现 Thoughtbot Q/A 演讲前 5 分钟所讨论的内容;异步上传文件,然后保留模型及其附加的文件。
http://ui.thoughtbot.com/assets/backbone_js_rails_chat_episode_1_part_1.m4a
我已经设置up 后端上的 Carrierwave 和客户端上的 Plupload,我能够使请求并上传文件。但是我不确定如何发送响应中讨论的令牌,然后保留模型。
所以我有一个带有标题输入和一个添加图像的 plupload 按钮的表单,然后我有一个应该进行上传的保存按钮,然后保存模型(照片,带有安装的 Carrierwave 上传器和标题属性)
如何我可以将这两个请求合并到一个按钮上提交吗? 这一切将如何实施?
Im trying to achieve what's talked about in the first 5 minutes of the Thoughtbot Q/A talk; Upload a file async and then persist the model with the file attached to it.
http://ui.thoughtbot.com/assets/backbone_js_rails_chat_episode_1_part_1.m4a
I've set up carrierwave on the backend and Plupload on the client and am able to make the request and upload the file. However I'm unsure about how I would send the token being talked about back in the response and then persist the model.
So I have a form with a title input and a plupload button that adds the image, I then have a save button that's supposed to make the upload, then save the model (Photo, with a mounted Carrierwave uploader and a title attribute)
How would I combine the two requests into being submitted on one single button?
How would all this be implemented ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 iframe 目标(上传)位于同一服务器上,您可以返回类似于 JSONP 的内容。然后
让上传脚本返回
If the iframe target (the upload) is on the same server you can return something analogous to a JSONP. something like
Then have the upload script return