英文:
Limit upload size for appengine interface to cloud store
问题
考虑一个将图像(头像)上传到Google Cloud Storage的功能,该功能将从用户的Web浏览器开始,然后通过一个Go appengine实例,该实例将处理标准的压缩/裁剪等操作,然后将生成的图像设置为Cloud Storage中的对象。
如何确保appengine实例不会被过多或错误的数据超载?换句话说,我认为我在问两个问题(或者可能不是两个问题):
-
如何限制在单个请求中允许发送到appengine实例的数据量,或者是否已经有一个默认的安全限制?
-
如何验证数据,以确保它是正确的jpg/png/gif格式,然后再尝试使用标准的Go图像库进行处理?
英文:
Consider an image (avatar) uploader to Google Cloud Storage which will start from the user's web browser, and then pass through a Go appengine instance which will handle standard compression/cropping etc. and then set the resulting image as an object in Cloud Storage
How can I ensure that the appengine instance isn't overloaded by too much or bad data? In other words, I think I'm asking two questions (or possibly not):
-
How can I limit the amount of data allowed to be sent to an appengine instance in a single request, or is there already a default safe limit?
-
How can I validate the data to make sure it's proper jpg/png/gif before attempting to process it with standard go image libraries?
答案1
得分: 0
-
所有的App Engine请求都限制在32MB以内。
-
在上传开始之前,你可以检查要上传的文件的大小。
-
你可以验证文件的MIME类型,只允许正确的文件被上传。
英文:
-
All App Engine requests are limited to 32MB.
-
You can check the size of the file being uploaded before the upload starts.
-
You can verify the file's mime-type and only allow correct files to be uploaded.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论