Sunday, 15 February 2015

google app engine - Grails AppEngine file upload using GAEVFS -


I am working on Grails web application and need to upload files. I have a form (simplified):

  & lt; G: form action = "save" method = "post" enctype = "multipart / form-data" & gt; & Lt; Input type = "file" id = "image" name = "image" /> & Lt; Input class = "save" type = "submit" value = "create" /> & Lt; / G: form & gt;  

and controller code should not (I know that this controller, but it's just to make it work and be better designed):

 < Code> def save = {GaeVFS.setRootPath (servletContext.getRealPath ("/")); FileSystemManager fsManager = GaeVFS.getManager (); File object tmpFolder = fsManager.resolveFile ("gae: // WEB-INF / upload_files"); If (! TmpFolder.exists ()) {tmpFolder.createFolder (); } // I need the code here to save the image in GAEVFS via bigtable}  

Then I have two problems:

One. Because when saving to the button is pressed an exception it tries to use tries to save the Apache Commons FileUpload system file

I disable it

The exception is:. Java. Lang.NoclassDefFoundError: java.rmi.server.UID is a restricted class. Please refer to the Google App Engine Developer's Guide for more information. com.google.appengine.tools.development.agent.runtime.Runtime.reject (Runtime.java:51) on org.apache.commons.fileupload.disk.DiskFileItem. (DiskFileItem.java:103) at org.apache. On commons.fileupload.disk.DiskFileItemFactory.createItem org.apache.commons.fileupload.FileUploadBase.parseRequest (DiskFileItemFactory.java:196) (FileUploadBase.java:358)

B. I need the code example to save the image through Gaevfs I've seen examples in GaeVfsServlet but I see now how much right do not know that my case is this. Any kind of help is welcome

GaeVfsServlet URL:.

I came across this very problem and I am using a grails plugin called ajaxuploader To get a solution to the problem - Using the Commons File Upload API at all is available for your controller in the form of an InputStream object and doesnt upload that file

<. P>


No comments:

Post a Comment