Uploader is reading any file larger than 100kb but files having size lower than 100kb multipartFile object is null

The command object is

class UploadInfoListCommand implements Validateable{   MultipartFile infoMasterFile   String localeFileileExtension

  static constraints = {
    infoMasterFile  validator: { val, obj ->
      if ( val == null ) {
        return false
      }
      if ( val.empty ) {
        return false
      }

      ['xlsx'].any { extension -> // <1>
        val.originalFilename?.toLowerCase()?.endsWith(extension)
      }
    }   }

and the GSP code is

<div class="input-group">
                <input type="text" class="form-control" readonly placeholder="${message(code:'info.uploadModal.language.placeholder.file', default:'Please select a document')}" id="bulkUploadDocumentInfo"/>
                <label class="input-group-addon btn btn-default" for="bulkUploadDocument">
                  <input type="file" id="bulkUploadDocument" name="infoMasterFile" style="display:none;" data-validate="maxFileSizeMB(5)" onchange="$('#bulkUploadDocumentInfo').val(this.files[0].name);">
                  <g:message code="info.uploadModal.language.label.searchFile" default="Add New File" />
               </label>
</div>
0

There are 0 best solutions below