Reputation: 85
I am wondering how to fix this error in google app engine using flask. I understand that a file cannot exceed 32 MB. I am uploading videos and trying to store them in google cloud storage, I need to handle large videos. I have heard that using blobstore api may help but have not found much documentation on this and how I can implement it in this code.
<form id = "form2" action="{{ url_for('createPost') }}" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="files4">Video:</label>
<input type="file" id="files4" name='files4'>
</div>
</form>
def createPost():
if request.method == 'POST':
s = db.session()
try:
files4 = request.files.getlist('files4')
print(files4)
except Exception as e:
print("[Upload] Got exception: %s" % str(e))
return redirect(url_for('projects'))
Upvotes: 1
Views: 1682
Reputation: 5276
Here are 2 methods by which you can do this via blobstore:
1 - create_upload_url
and here is an example
https://www.programcreek.com/python/example/103205/google.appengine.ext.blobstore.create_upload_url
2 - BlobstoreUploadHandler
however this requires you to use webapp2 instead of flask, although you could setup a webapp2 micro-service just for this endpoint
If neither of these methods work, then you'd need to setup an app engine flex micro-service, so that you can edit the nginx conf to all files larger that 32 MB
Upvotes: 2