String latitude = req.getParameter("latitude");
String longitude = req.getParameter("longitude");
String date = req.getParameter("date");
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
Map<String, BlobKey> blobs = blobstoreService.getUploadedBlobs(req);
BlobInfoFactory blobInfoFactory = new BlobInfoFactory();
long maxPhotoSize = adminConfigDao.getMaxPhotoSize();
ArrayList<BlobKey> validSubmissionKeys = new ArrayList<BlobKey>();
for (Entry<String, BlobKey> entry : blobs.entrySet()) {
BlobKey blobKey = entry.getValue();
BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey);
String contentType = blobInfo.getContentType().toLowerCase();
long size = blobInfo.getSize();
if (!contentType.startsWith("image/")) {
blobstoreService.delete(blobKey);
LOG.warning(String.format("Uploaded file has content type '%s'; skipping.", contentType));
continue;
}
if ((size > maxPhotoSize) || (size == 0)) {
blobstoreService.delete(blobKey);
LOG.warning(String.format("Uploaded file is %d bytes; skipping.", size));
continue;
}
validSubmissionKeys.add(blobKey);