need to be more specific what your BlobstoreService is doing/used library

On Wed, Mar 7, 2012 at 4:01 PM, learning coding <[email protected]
> wrote:

> Hi all ,
>
> I have to make webapplication using java,
> I have to upload a file which is bigger then 1MB .
> Actually i need the contentStream of the file and the value of the
> textBox which is on the FormPanel ,on the myProject.server side .
>
> The file can be of .txt and .doc type.
>
> Somebody suggested me to use BolbStore.
>
>
> My Code :
>
> Code
>      client
>      // Get The URL
>      public void onClick(ClickEvent event) {
>                  System.out.println("blob" +blobServices);
>                blobServices
>                    .getBlobStoreUploadUrl(callback) ;
>              }
>            });
>
> //
> ..Some more code
>
> public void onSubmitComplete(SubmitCompleteEvent event) {
>
>                                          Window.alert(event.getResults());
>                  }
>
>                });
>
> The above RPC call is working fine i am able get the URL.
> Now i have to use this URL with servlet which is used to upload a
> file.
>
>       AsyncCallback callback = new AsyncCallback() {
>
>                public void onFailure(Throwable caught) {
>                        // TODO Auto-generated method stub
>                        caught.printStackTrace();
>                }
>
>                public void onSuccess(Object result) {
>                String tmp = result.toString();
>                        uploadForm.setAction(tmp);
>
>            // Submit the form to complete the upload
>            uploadForm.submit();
>            uploadForm.reset();
>                }
>        };
>
> On server Side
>
>     public class UploadServiceImpl extends HttpServlet {
>
>           BlobstoreService blobstoreService =
> BlobstoreServiceFactory.getBlobstoreService();
>
>     public void doPost(HttpServletRequest req, HttpServletResponse
> res)
>              throws ServletException, IOException {
>
>            Map<String, BlobKey> blobs =
> blobstoreService.getUploadedBlobs(req);
>            BlobKey blobKey = blobs.get("upload");
>
>                    if(blobKey == null){
>                                res.sendRedirect("/");
>                    }else{
>                        res.sendRedirect("/serve?blob-key="
> +blobKey.getKeyString());
>                    }
>      }
>
>     }
>
> With this Code I am able to view only the .txt file on
> Window.alert(event.getResults());
> and also the size of .txt file is greater then 2 MB.
>
> But when i submit the xyz.doc file it gives option to save file and
> also the name of the file xyz.doc is changed to serve.doc
> the size of the file is 130 KB.
>
> Plz tell me what to do. file can be of type .txt or .doc with size
> greater then 1 MB.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" 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-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=en.

Reply via email to