I'm trying to block unwanted content-type of uploaded files. I'm using the code from documentation:
class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
upload_files = self.get_uploads('file') # 'file' is file upload field in the form
blob_info = upload_files[0]
self.redirect('/serve/%s' % blob_info.key())
What I've found out is that before the last line with redirect, the blob is already in blobstore, so the only thing left to do is to check it's content-type and perform delete if it is unwanted.
Is there any other way to discard the file before it hits blobstore?