App Engine Blobstore. What can I do to limit the size of a file that a user can upload?

What can I do to limit the size of the file that can be downloaded? I know that I can limit it to the client side using SWFUpload, but how can I limit it to the server side?

How can I protect against the fact that someone uploaded a 1 GB file and ate my quota?

+6
java google-app-engine blobstore
source share
3 answers

The App Engine 1.5.4 SDK introduced an option to specify a limit on the size of the blog upload.

See maxUploadSizeBytes and maxUploadSizeBytesPerBlob class.

+7
source share

You cannot prevent people from uploading files that are too large (although this will create a good function request ). What you can do is check the size of the downloaded blob and immediately delete it if it is too large.

+2
source share

Put the code below in the serlet where you get the data before calling the data warehouse API.

 // Determine the HTTP method long maxSize = 1024*1024 * 50; //Limit 50 MB boolean isPostMethod = request.getMethod().equals("POST"); // Verify the content length int contentLength = request.getContentLength(); if (isPostMethod && (contentLength < 0 || contentLength > maxSize)) //posted data size is not in acceptable range else { // Process Data } 
-one
source share

All Articles