Re: blobstore not allowing access to a file 1 mb with one api call + zip files

2010-09-06 Thread branflake2267
You'll need to start a task to do the job, but tasks are limited to
30s. In this case you use the mapreduce api, to read the entire blob
you upload and do what you need.

Here is my Demo GWT project for Blobstore upload: 
http://demofileuploadgae.appspot.com/
Here is code for the demo:
http://code.google.com/p/gwt-examples/source/browse/#svn/trunk/DemoUpload/src/org/gonevertical/upload/server/mapreduce

This doesn't have the exact code you need, but has the frame you'll
need to get going with the api. It works fantastic for reading blobs.

Hope that helps,
Brandon Donnelson

On Aug 20, 10:46 am, GKotta guruko...@gmail.com wrote:
 Hi,

 I have my users upload a zip file full of images (all of which are
 less than 1 mb, so theoretically, I should be able to access each
 image with one api call.) The problem is that this doesn't work in
 practice. I want to use theblobstoreto upload the zip file then put
 each individual image in the datastore. Below is my code. The method
 getNextEntry() reads the next ZIP file entry and positions the stream
 at the beginning of the entry data.

 MapString, BlobKey blobs = blobstoreService.getUploadedBlobs(req);
                 BlobKey blobKey = blobs.get(uploadFormElement);
                 ZipInputStream zipper = new ZipInputStream(new
 BlobstoreInputStream(blobKey));
                 ZipEntry entry = zipper.getNextEntry();
                 int read;
                 int start = 0;
                 byte[] buffer = new byte[1048576];

                 while ((read = zipper.read(buffer, start, buffer.length)) !=
 -1)
                         start +=
 read;

                 byte[] imageBytes = new byte[start];

                 System.arraycopy(buffer, 0, imageBytes, 0, start);

                 Blob imageBlob = new Blob(imageBytes);

 The exception that I get is Caused by:
 com.google.apphosting.api.ApiProxy$ApplicationException:
 ApplicationError: 6: Blob fetch size too large. on the line ZipEntry
 entry = zipper.getNextEntry();

 Does anyone know how to solve this?

 Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



blobstore not allowing access to a file 1 mb with one api call + zip files

2010-08-20 Thread GKotta
Hi,

I have my users upload a zip file full of images (all of which are
less than 1 mb, so theoretically, I should be able to access each
image with one api call.) The problem is that this doesn't work in
practice. I want to use the blobstore to upload the zip file then put
each individual image in the datastore. Below is my code. The method
getNextEntry() reads the next ZIP file entry and positions the stream
at the beginning of the entry data.

MapString, BlobKey blobs = blobstoreService.getUploadedBlobs(req);
BlobKey blobKey = blobs.get(uploadFormElement);
ZipInputStream zipper = new ZipInputStream(new
BlobstoreInputStream(blobKey));
ZipEntry entry = zipper.getNextEntry();
int read;
int start = 0;
byte[] buffer = new byte[1048576];

while ((read = zipper.read(buffer, start, buffer.length)) !=
-1)
start +=
read;

byte[] imageBytes = new byte[start];

System.arraycopy(buffer, 0, imageBytes, 0, start);

Blob imageBlob = new Blob(imageBytes);

The exception that I get is Caused by:
com.google.apphosting.api.ApiProxy$ApplicationException:
ApplicationError: 6: Blob fetch size too large. on the line ZipEntry
entry = zipper.getNextEntry();

Does anyone know how to solve this?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.