1

I to be able to limit the file upload size for my website. Here is my code:

 def p = request.getFile('as')
        if(!a.empty) {
            a.transferTo( new File(abass) )
            response.sendError(200,'Done')

Is there a way to do it programmatically, or do I need to change something in a Grails config file?

cdeszaq
  • 30,869
  • 25
  • 117
  • 173
John22_2
  • 123
  • 1
  • 1
  • 7

2 Answers2

3

I think you should be able to use the following, convert it to the resources.groovy DSL format, and it should work...

<bean id="multipartResolver"> 
    <property name="maxUploadSize"> 
         <value>xxxxxxxx</value> 
    </property> 
</bean> 
Gregg
  • 34,973
  • 19
  • 109
  • 214
0

You can look at the file uploader plugin. It makes it easy to configure the max size and type of upload among other things.

sul
  • 267
  • 1
  • 9