html - Grails No signature of method: org.apache.catalina.core.ApplicationHttpRequest.getFile() -


i keep on getting error message when go open upload page of grails application:

no signature of method: org.apache.catalina.core.applicationhttprequest.getfile()   applicable argument types: (java.lang.string) values: [file]   possible solutions: getxml(), getpart(java.lang.string), getat(java.lang.string),   getat(java.lang.string), getlocale(), getinfo() 

here's html code :

<html> <head>     <meta name="layout" content="main"/>     <title></title>     <style type="text/css">         label{             float:left;             width:65px;         }     </style> </head> <body>     <g:uploadform action="upload">         <input type="file" name="file">         <g:submitbutton name="upload" value="upload"/>     </g:uploadform> </body> </html> 

and corresponding controller class

package org.example.test class adminaccesscontroller {     def upload() {               def f = request.getfile('file')         def alllines= f.inputstream.tocsvreader().readall()      } } 

i've tried importing quite ton of various libraries fix problem, haven't figured out going on. can tell, end writing file csv reader. followed document on official grails github exactly: http://grails.github.io/grails-doc/latest/guide/theweblayer.html#uploadingfiles, nothing seems working.

can me out?

thanks.

the instance of request arriving controller applicationhttprequest has no getfile method.

you need change type of request defaultmultiparthttpservletrequest.

that can done changing enctype in uploadform multipart/form-data this:

<g:uploadform action="upload" enctype='multipart/form-data'>     <input type="file" name="file">     <g:submitbutton name="upload" value="upload"/> </g:uploadform> 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -