简体   繁体   English

Rails中的XMLHttprequest post方法

[英]XMLHttprequest post method in rails

how to send file through xmlhttprequest.send(file) in rails , post method not calling respective action(method) in the controller , get method calling the same action which specified in the post method and how to get the request(body) content in the controller ? 如何通过rails中的xmlhttprequest.send(file)发送文件,post方法未在控制器中调用相应的action(方法),get方法调用与post方法中指定的动作相同的方法以及如何获取request(body)内容控制器?

Any idea? 任何想法?

You should be able to get it from your request object. 您应该能够从您的请求对象获取它。 Maybe something like this: 也许是这样的:

path = "public/" File.open(path, "wb") { |f| path =“ public /” File.open(path,“ wb”){| f | f.write(request.body.read) } f.write(request.body.read)}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM