Tuesday, September 27, 2011

Upload files with Grails

I found several examples of uploading files with Grails but neither one works for me. So here is snippet of code that is actually working (at lease for me). Maybe someone will find it useful.

Controller method look like this:
// inputTagName shoud be "myFile"
public MultipartFile readUploadFile(HttpServletRequest request, 
String inputTagName) {
  return request.getFile(inputTagName)  

Here is GSP page snippet:


No comments:

Post a Comment