[英]I want to limit the pdf file size uploaded to firebase storage. I want that user can upload a file with maximum size of 7MB
I want put a limitation on firebase storage. 我想对firebase存储设置限制。 That is user can upload a pdf file of maximum size of 7MB.
也就是说用户可以上传最大7MB的pdf文件。 And How can i reduce the size of pdf file?
我怎样才能减小pdf文件的大小? is there any way in android.
在android中有什么办法吗?
I don't know the solution of my question. 我不知道我的问题的解决方案。 I find a lot but doesn't get my answer.
我找到了很多,但没有得到我的答案。 Can someone help me with firebase security rules?
有人可以帮我解决firebase安全规则吗? I am not familiar with that doesn't find any answer about this.
我不熟悉,没有找到任何答案。
The Firebase documentation on security rules has an example that shows (amongst others) how to set the maximum size of files that can be stored: 有关安全规则的Firebase文档中有一个示例,其中显示了(如此)如何设置可以存储的文件的最大大小:
service firebase.storage { match /b/{bucket}/o { match /images { // Cascade read to any image type at any path match /{allImages=**} { allow read; } // Allow write files to the path "images/*", subject to the constraints: // 1) File is less than 5MB // 2) Content type is an image // 3) Uploaded content type matches existing content type // 4) File name (stored in imageId wildcard variable) is less than 32 characters match /{imageId} { allow write: if request.resource.size < 5 * 1024 * 1024 && request.resource.contentType.matches('image/.*') && request.resource.contentType == resource.contentType && imageId.size() < 32 } } } }
Since these rules will only be applied after the actual upload has completed (but before the file is actually stored in your storage bucket), you'll typically also want to check the file size in your Android app before uploading it, to prevent using bandwidth for a file that is too large. 由于这些规则仅在实际上传完成后应用(但在文件实际存储在存储桶中之前),因此您通常还需要在上传之前检查Android应用中的文件大小,以防止使用带宽对于太大的文件。 For some examples of how to check the local file size on Android, see Get the file size in android sdk?
有关如何在Android上检查本地文件大小的一些示例,请参阅在android sdk中获取文件大小?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.