I use Apache Commons FileUpload in a java server-side app that has a html form with fields :
This app I want to upload on GAE . 
I can receive uploaded file (as a stream , using org.apache.commons.fileupload.FileItemStream). 
I want to receive too input textfields (i.e. 1) and 2)) - completed by the user of app)
I want to access these using org.apache.commons.fileupload.FileItem  but I receive java.rmi.server.UID is a restricted class
You should use the FileItemIterator of the Apache Commons FileUpload.
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import java.io.InputStream;
..
public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    try {
      ServletFileUpload upload = new ServletFileUpload();
      res.setContentType("text/plain");
      FileItemIterator iterator = upload.getItemIterator(req);
      while (iterator.hasNext()) {
        FileItemStream item = iterator.next();
        String name = item.getFieldName();
        InputStream stream = item.openStream();
        if (item.isFormField()) {
          //regular form field
          resp.getWriter().println(("Form:" + name + " : " + Streams.asString(stream));
        } else {
          //fileform field 
          resp.getWriter().println(("File:" +name + " : " + item.getName());
        }
      }
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
}
                        Take a look at this: Google App Engine and FileUpload
You can't write directly to the filesystem in GAE, but take a look at GAEVFS, which uses the datastore and memcache to emulate a filesystem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With