File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -7721,6 +7721,15 @@ - (void)documentPickerPresenter:(MXKDocumentPickerPresenter *)presenter didPickD
7721
7721
{
7722
7722
self.documentPickerPresenter = nil ;
7723
7723
7724
+ // Check maxUploadSize accepted by the home server before trying to upload.
7725
+ NSUInteger maxUploadFileSize = self.roomDataSource .mxSession .maxUploadSize ;
7726
+ NSDictionary *fileAttributes = [NSFileManager .defaultManager attributesOfItemAtPath: url.path error: nil ];
7727
+ if (fileAttributes && fileAttributes.fileSize > maxUploadFileSize) {
7728
+ [self showAlertWithTitle: @" The file you want to upload is too big."
7729
+ message: [NSString stringWithFormat: @" \n The file you want to upload is too big.\n\n It mustn't weight more than %ld MB" , maxUploadFileSize/(1024 *1024 )]];
7730
+ return ;
7731
+ }
7732
+
7724
7733
MXKUTI *fileUTI = [[MXKUTI alloc ] initWithLocalFileURL: url];
7725
7734
NSString *mimeType = fileUTI.mimeType ;
7726
7735
Original file line number Diff line number Diff line change
1
+ Check filesize before uploading file to server and display alert if file is too big.
You can’t perform that action at this time.
0 commit comments