Grails file upload - how to recognize file and/or content type?

后端 未结 3 1779
执笔经年
执笔经年 2021-02-08 16:05

I\'m a Grails beginner, so please be patient with me. Currently I\'m having hard times manipulating file uploads. As far as I understand using request.getFile() I c

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-08 16:38

    From server side it is possible to use the configuration at application.yml to limit file size application wide.

    Just insert this code on your application.yml:

    grails:
      controllers:
        upload:
          maxFileSize: 3145728 # 3 * 1024 * 1024 = 3 MB The maximum file size
          maxRequestSize: 3145728 # The maximum request size
    

    See:

    Grails Guide - upload file

    Grails3 file upload maxFileSize limit

提交回复
热议问题