Search code examples
pythongoogle-app-engineblobstore

Google App Engine Blob Store... Syntax for changing file size?


I am running an python web app on google app engine.

I use the blobstore to store images that the user can upload.

from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers

(this is just to clarify, not the datastore, but the blobstore)

Anyways, I'm worried about possibly there being a stupid or malicious user who logs on and uploads a file of ridiculous size and fills up all of my quotas.

Is there any way to set a limit to the file size a user can upload?

Maybe 1mb? or even 5mb?

Thank you


Solution

  • You can limit the size of any blob file for a given upload_url using max_bytes_per_blob see: https://developers.google.com/appengine/docs/python/blobstore/functions#create_upload_url