Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to process a CommonsMultipartFile
    primarykey
    data
    text
    <p>I'm trying to implement upload code for grails. When the file is processed on my controller I get this error:</p> <pre><code>ERROR errors.GrailsExceptionResolver - Exception occurred when processing request: [POST] /com.jason.score/fileResource/uploads Stacktrace follows: groovy.lang.MissingMethodException: No signature of method: static org.hsqldb.types.Binary.storeMyFileMethod() is applicable for argument types: (org.springframework.web.multipart.commons.CommonsMultipartFile) values: [org.springframework.web.multipart.commons.CommonsMultipartFile@1a17db8] at com.jason.score.FileResourceController$_closure4_closure6.doCall(FileResourceController.groovy:73) at com.jason.score.FileResourceController$_closure4.doCall(FileResourceController.groovy:72) at com.jason.score.FileResourceController$_closure4.doCall(FileResourceController.groovy) at java.lang.Thread.run(Thread.java:662) </code></pre> <p>My controller function looks like this:</p> <pre><code> def uploads = { Collection result = [] Binary binary request.getFileNames().each { binary = Binary.storeMyFileMethod(request.getFile(it)) result &lt;&lt; [name: binary.getFileName(), size: binary.getFileSize()] } render result as JSON } </code></pre> <p>My view looks like this:</p> <pre><code> &lt;g:form name="fileupload" url="[action:'uploads',controller:'fileResource']" method="POST" enctype="multipart/form-data"&gt; .... &lt;input type="file" name="files[]" multiple&gt; &lt;/g:form&gt; </code></pre> <p>Can anyone explain what is going wrong and how I can process each file that is uploaded (can be multiple files)?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload