0
我找不出如何做附件。已安裝的插件「郵件」和有問題的文件是一個.csv從窗體上傳(成功)。Grails郵件插件:attach org.springframework.web.multipart.commons.CommonsMultipartFile
這工作:
def f = request.getFile('uploadedFile')
//do a bunch of stuff with f and make bodyString
MailService.sendMail {
to "[email protected]"
subject "subject"
body bodyString
}
這不:
def f = request.getFile('uploadedFile')
//do a bunch of stuff with f and make bodyString
MailService.sendMail {
multipart true
to "[email protected]"
subject "subject"
body bodyString
attach "myfile.csv", f
}
噢錯誤這樣說:
groovy.lang.MissingMethodException: No signature of method: my_project.MySweetController.attach() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, org.springframework.web.multipart.commons.CommonsMultipartFile) values: [Demo myfile.csv, [email protected]3e2d16b]
Possible solutions: each(groovy.lang.Closure)
f.getBytes()就是我現在所擁有的。謝謝!! – Mikey 2011-05-19 10:28:22