Open anixan opened 11 years ago
Hi There,
I'm not sure how the plugin works with Grails 2.x since I wrote it for 1.x. It looks to me like the Servlet API has changed significantly and that might be why the plugin throws this error.
This post might be of use to you:
http://stackoverflow.com/questions/12439135/uploading-a-file-in-grails
Seems like they are not using getFile but reading the inputStream.
Cheers Antony
On 21 July 2013 11:09, anixan notifications@github.com wrote:
Hi,
I have installed this plugin and it looks quite good at first and all went well. I have the view setup as below:
url="${[controller:'upload', action:'check']}" debug="true" multiple="true" > /uploader:uploader
and my config is has the code shown in the documentation. So I have the files limited to CSV files only and then I select a 7kb CSV to upload and I get a log from the controller that it hit there successfully however the first thing is the view always returns a Failed message.
the console shows this:
POST http://localhost:8080/my_app/upload/precheck?qqfile=messages.csv 500 (Internal Server Error) bundle-bundle_fileuploader_defer.js:1204 qq.extend._upload bundle-bundle_fileuploader_defer.js:1204 qq.UploadHandlerAbstract.upload bundle-bundle_fileuploader_defer.js:892 qq.FileUploaderBasic._uploadFile bundle-bundle_fileuploader_defer.js:397 qq.FileUploaderBasic._uploadFileList bundle-bundle_fileuploader_defer.js:388 qq.FileUploaderBasic._onInputChange bundle-bundle_fileuploader_defer.js:372 qq.UploadButton.onChange bundle-bundle_fileuploader_defer.js:309 (anonymous function) bundle-bundle_fileuploader_defer.js:825
So I just presumed it always returns failed as cant see what the issue could be as get the same message in Chrome, Safari, FireFox etc. So the next thing is I went on to try and read the file in the controller with this code:
def check() {
println("Inside Check") def file = request.getFile('file') def lines = file.inputStream.toCsvReader().readAll() println(lines)
}
Now when I select a file and it processes it still returns a Failed on the view, and I get this error on the grails side of things:
Inside Check | Error 2013-07-21 10:37:10,137 [http-bio-8080-exec-23] ERROR errors.GrailsExceptionResolver - MissingMethodException occurred when processing request: [POST] /my_app/upload/check - parameters: qqfile: messages.csv No signature of method: org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper.getFile() is applicable for argument types: (java.lang.String) values: [file] Possible solutions: getXML(), getPart(java.lang.String), getAt(java.lang.String), getAt(java.lang.String), getLocale(), getJSON(). Stacktrace follows: Message: No signature of method: org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper.getFile() is applicable for argument types: (java.lang.String) values: [file] Possible solutions: getXML(), getPart(java.lang.String), getAt(java.lang.String), getAt(java.lang.String), getLocale(), getJSON() Line | Method
->> 29 | check in com.mytool.UploadController$$EOCDVxh2
| 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run . . in '' ^ 680 | run in java.lang.Thread
I hope you can help me resolve this issue as really need to get this working:S
Thanks in advance
— Reply to this email directly or view it on GitHubhttps://github.com/aiten/grails-ajax-uploader/issues/20 .
ꜽ . antony jones . http://www.enzy.org
Hi,
Thanks I have received the resource and tried to read the input stream however I get an error about the object being null.
No signature of method: java.lang.String.getInputStream() is applicable for argument types: () values: []. Stacktrace follows:
I think this may have something to do with the Failed message I keep getting on the view. Does the failed message signify that the file hasn't been processed correctly?
It sounds like the encType isn't set correctly by the javascript perhaps (as detailed in that post I sent you) - you might have to hack about a bit to see if you can get it to work.
Maybe request.dump() will give you some info.
I'd look into it but I simply won't have the time for a few weeks yet.
On 21 July 2013 11:29, anixan notifications@github.com wrote:
Hi,
Thanks I have received the resource and tried to read the input stream however I get an error about the object being null.
No signature of method: java.lang.String.getInputStream() is applicable for argument types: () values: []. Stacktrace follows:
I think this may have something to do with the Failed message I keep getting on the view. Does the failed message signify that the file hasn't been processed correctly?
— Reply to this email directly or view it on GitHubhttps://github.com/aiten/grails-ajax-uploader/issues/20#issuecomment-21308043 .
ꜽ . antony jones . http://www.enzy.org
Hi,
Could the issue be something todo with the file not being picked up correctly as I am running my app on LocalHost on a mac and that might be why I am getting a failed message?
No, it should work fine locally.
On 21 July 2013 11:48, anixan notifications@github.com wrote:
Hi,
Could the issue be something todo with the file not being picked up correctly as I am running my app on LocalHost on a mac and that might be why I am getting a failed message?
— Reply to this email directly or view it on GitHubhttps://github.com/aiten/grails-ajax-uploader/issues/20#issuecomment-21308219 .
ꜽ . antony jones . http://www.enzy.org
Ok stupidly I didn't create the director that is stated in the config (/tmp/uploaded.file). Where would I need to create this in my project structure?
That's a unix path, not part of the project structure.
If you are on unix it will work, or give it a new path which exists on your machine On 23 Jul 2013 12:16, "anixan" notifications@github.com wrote:
Ok stupidly I didn't create the director that is stated in the config (/tmp/uploaded.file). Where would I need to create this in my project structure?
— Reply to this email directly or view it on GitHubhttps://github.com/aiten/grails-ajax-uploader/issues/20#issuecomment-21407336 .
if im on ubuntu then that should work otb? or where in the filesystem do I create the folder?
Thanks for all the help on this :)
Yeah, on Ubuntu it should just work out of the box.
Hi,
I have installed this plugin and it looks quite good at first and all went well. I have the view setup as below:
uploader:uploader id="uploadBtn" allowedExtensions="${"[\'csv\']"}" url="${[controller:'upload', action:'check']}" debug="true" multiple="true"
and my config is has the code shown in the documentation. So I have the files limited to CSV files only and then I select a 7kb CSV to upload and I get a log from the controller that it hit there successfully however the first thing is the view always returns a Failed message.
the console shows this:
POST http://localhost:8080/my_app/upload/precheck?qqfile=messages.csv 500 (Internal Server Error) bundle-bundle_fileuploader_defer.js:1204 qq.extend._upload bundle-bundle_fileuploader_defer.js:1204 qq.UploadHandlerAbstract.upload bundle-bundle_fileuploader_defer.js:892 qq.FileUploaderBasic._uploadFile bundle-bundle_fileuploader_defer.js:397 qq.FileUploaderBasic._uploadFileList bundle-bundle_fileuploader_defer.js:388 qq.FileUploaderBasic._onInputChange bundle-bundle_fileuploader_defer.js:372 qq.UploadButton.onChange bundle-bundle_fileuploader_defer.js:309 (anonymous function) bundle-bundle_fileuploader_defer.js:825
So I just presumed it always returns failed as cant see what the issue could be as get the same message in Chrome, Safari, FireFox etc. So the next thing is I went on to try and read the file in the controller with this code:
def check() {
Now when I select a file and it processes it still returns a Failed on the view, and I get this error on the grails side of things:
Inside Check | Error 2013-07-21 10:37:10,137 [http-bio-8080-exec-23] ERROR errors.GrailsExceptionResolver - MissingMethodException occurred when processing request: [POST] /my_app/upload/check - parameters: qqfile: messages.csv No signature of method: org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper.getFile() is applicable for argument types: (java.lang.String) values: [file] Possible solutions: getXML(), getPart(java.lang.String), getAt(java.lang.String), getAt(java.lang.String), getLocale(), getJSON(). Stacktrace follows: Message: No signature of method: org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper.getFile() is applicable for argument types: (java.lang.String) values: [file] Possible solutions: getXML(), getPart(java.lang.String), getAt(java.lang.String), getAt(java.lang.String), getLocale(), getJSON() Line | Method ->> 29 | check in com.mytool.UploadController$$EOCDVxh2
| 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run . . in '' ^ 680 | run in java.lang.Thread
I hope you can help me resolve this issue as really need to get this working:S
Thanks in advance