grails如何从xhr获取文件? 我的ajax
var xhr = new XMLHttpRequest()
xhr.open("POST", "actionGrails", true)
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("X-File-Name", file.fileName);
xhr.setRequestHeader("X-File-Size", file.fileSize);
xhr.setRequestHeader("Content-Type", "multipart/form-data");
xhr.send(file);
在我的控制器中
def actionGrails() {
def f = request.getFile('file')
println f//get error
}
任何解决方案?感谢