apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
598 stars 885 forks source link

IOS 13 Video files are not uploading #247

Closed officerreports closed 4 years ago

officerreports commented 4 years ago

Bug Report

IOS 13 Big video files are not uploading.

Problem

We have an app which uploads video,audio,images and docs to the server. Prior ios 13 that is ios 12 the video files used to upload whether large or small. But now large file size with above 50MB size are failing to upload to the server.

What is expected to happen?

Large video files with the size more than 50MB should upload, which used to happen and is happening in the lower versions of ios but having an issue in IOS 13.

What does actually happen?

When we try to upload a large file with a size of 52MB it just throws error to the cordova side.

Information

Have also checked in the Objective c code (CDVfiletranfer.m) of the file transfer plugin. this is the error which i was getting in the xcode.

2019-11-11 17:35:18.322215+0530 OfficerReports[2975:1293164] -[CDVFileTransfer requestForUploadCommand:fileData:] [Line 224] fileData length: 52041341

2019-11-11 17:35:18.393344+0530 OfficerReports[2975:1293164] THREAD WARNING: ['FileTransfer'] took '71.375977' ms. Plugin should use a background thread.

2019-11-11 17:35:19.946234+0530 OfficerReports[2975:1294084] File Transfer Finished with response code 413

2019-11-11 17:35:19.947255+0530 OfficerReports[2975:1294084] FileTransferError { body = "The page was not displayed because the request entity is too large."; code = 3; "http_status" = 413; source = "file:///var/mobile/Containers/Data/Application/0D7E7F52-76FE-4541-992C-87FFA4484FD3/tmp/trim.BC29DB30-721B-4698-AC7F-5499B7BB24E3.MOV"; target = "https://officerreports.net/api/FileUpload/Upload"; }

Command or Code

Environment, Platform, Device

Platform : IOS Device: IOS 13 devices

Version information

latest cordova file transfer plugin, xcode version 11.2.1

Checklist

breautek commented 4 years ago

This is not a fault of the plugin.

HTTP status code 413 means your server is rejecting the request because the request size is too big. You need to configure your server to allow for larger content bodies. How to do this obviously depends on what backend technologies you are using.

https://tools.ietf.org/html/rfc7231#section-6.5.11

officerreports commented 4 years ago

Initially i felt the same. But the file is uploading in ios 12 and android devices as well. Its the same API call which is happening in android and ios versions. We also increased the request size in the server side.

Apart from this the difference in ios 13 and ios 12 is that whichever video file is getting uploaded in ios 12 it doesn't trim the file in the image below.

IMG_3549

But the video file path comes with "trim.12345.mov" in case of IOS 13.

Not sure how to solve this. Please help

breautek commented 4 years ago

Just going by the error. If you're still receiving a 413 http status code, then that means the server is still rejecting due to request body size exceeding the limit. You have to make sure you check all your nodes.

For example, if you had an Node express app behind an nginx webserver, then you need to configure both nginx AND express as they both have a default max content size. I don't know your backend infrastructure therefore I cannot really comment anymore on this.

Also different phones, on different versions may record videos differently, resulting in different file sizes.

trim.12345.mov filename may or may not be another issue. Different iOS versions may handle files differently. So trim.12345.mov may be valid on iOS 13.

timbru31 commented 4 years ago

Closing as we can't fix server limitations and 413 is one.