upload multiple files at once

54 views
Skip to first unread message

Francisco de la Cruz Olmo

unread,
Aug 23, 2011, 2:43:10 AM8/23/11
to Google App Engine, juan.he...@ciber.com
Hi.

I want to upload multiple files with a HTML5 control
<input type="file" id="file_input" name="files" webkitdirectory=""
directory=""/>

In localhost not work but in appengine works fine.
When I upload files to blobstoreservice I see these files with the
blob viewer of the appengine console so it would be ok.

The problem is when I want to retrieve the blobkeys of these files.

BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();
Map<String, BlobKey> blobs =
blobstoreService.getUploadedBlobs( request )

Map size is 1.
I don't understand why I can't retrieve all blobkeys.

thanks.

Jose Montes de Oca

unread,
Aug 23, 2011, 6:16:49 PM8/23/11
to google-a...@googlegroups.com, juan.he...@ciber.com
Hi Francisco,


Hope this helps.

Best,
Jose Montes de Oca
Developer Support Specialist

Wen (Google)

unread,
Aug 23, 2011, 7:19:14 PM8/23/11
to Google App Engine
HTML5 allows you to upload multiple files at the same
time, however, on most browsers it gives all the files the same
name - in your case, it looks like "files" is the name. Therefore the
app engine api Map<String, BlobKey> blobs =
blobstoreService.getUploadedBlobs(req) only returns one blob key as
all the others get overwritten due to the unique keys constraint of
java.util.Map.

This is why the map size is 1.

One workaround might be to use javascript to change all the names of
the files before they are actually uploaded.

There is already an issue filed and acknowledged, you can star this
and follow until it's resolved: http://code.google.com/p/googleappengine/issues/detail?id=3351

- Wen



On Aug 23, 3:16 pm, Jose Montes de Oca <jfmontesde...@google.com>
wrote:
> Hi Francisco,
>
> check out this post on nicks blog:http://blog.notdot.net/2010/04/Implementing-a-dropbox-service-with-th...
Reply all
Reply to author
Forward
0 new messages