hey henry,
the gwt frontend code looks like java, but it is crosscompiled. that's the reason why the imports cannot be found - it's technically something completely different. so what you have to do is having an RPC call to your server, that returns a valid form url where you can upload your files. basically > BlobstoreService blobstoreService = > BlobstoreServiceFactory.getBlobstoreService(); must be in the servlet of your RPC and the value returned by then you get this url back and add it to your client code in .setAction .. hope that helps, ra On Thu, Dec 17, 2009 at 12:08 AM, Henry <[email protected]> wrote: > Hi Guys, > > Im trying to upload images using the new Blobstore API to the app > engine with GWT. > > Ive created a FormPanel() to upload the images to the app engine, but > when im trying to set up the action in the form using > BlobstoreService, i cant because the import com.google.appengine > cannot be resolved. > > My question is: how can I set up the action on the form using the > BlobstoreService?? I've this code in the client side: > > import com.google.appengine.api.blobstore.BlobstoreService; > > FormPanel form = new FormPanel(); > form.setEncoding(FormPanel.ENCODING_MULTIPART); > form.setMethod(FormPanel.METHOD_POST); > BlobstoreService blobstoreService = > BlobstoreServiceFactory.getBlobstoreService(); > form.setAction(blobstoreService.createUploadUrl("handizo/ > upload")); > > error: import com.google.appengine cannot be resolved. > > Ive also tried to setup the action without the BlobstoreService, but > when the form is read in the server side using the BlobstoreService: > > private BlobstoreService blobstoreService = > BlobstoreServiceFactory.getBlobstoreService(); > > protected void doPost(HttpServletRequest req, HttpServletResponse > resp) > throws ServletException, IOException { > > Map<String, BlobKey> blobs = > blobstoreService.getUploadedBlobs(req); > BlobKey blobKey = blobs.get("myFile"); > > if (blobKey == null) { > resp.sendRedirect("/"); > } else { > resp.sendRedirect("/serve?blob-key=" + > blobKey.getKeyString()); > } > > I've this other error saying me that I've to set up the action using > the BlobstoreService. > > Error: Must be called from a blob upload callback request. > at > com.google.appengine.api.blobstore.BlobstoreServiceImpl.getUploadedBlobs > (BlobstoreServiceImpl.java:97) > at com.handizo.server.service.FileUploadAnnouncementServlet.doPost > (FileUploadAnnouncementServlet.java:23) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:713) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) > > So its possible to user the BlobstoreService with GWT by the moment?? > > Thanks in advance :-) > > -- > > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
