ionic-team / ionic-v3

The repo for Ionic 3.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
128 stars 85 forks source link

File size is 0 only for videos when using input type file after iOS 13.2 #1077

Open ionitron-bot[bot] opened 4 years ago

ionitron-bot[bot] commented 4 years ago

Original issue by @sudarshanadayananda on 2019-11-21T13:11:32Z

Bug Report

Ionic version: 3.19.1

Current behavior: When calculating size of a file which selected using input type file, size is always 0 only for video files only on iOS devices with greater that iOS 13.2

Expected behavior: Should be able to calculate the file size which selected using input type file on all the mobile devices.

Steps to reproduce: Run the given stackblitz demo on a iOS device with IOS 13.2.

Related code:

HTML code.

<div>
  <input type="file" accept="*" (change)="onSelect($event)">
  <button ion-button (click)="calcSize()">calculate size</button>
</div>
<p>Size: {{ size }}</p>

TS code.

  file: File;
  size: number;

  onSelect(event: any) {

    this.file = event.target.files[0];
  }
  calcSize() {

    this.size = this.file.size;
  }

StackBlitz Demo

Other information:

OS version: Mac OS Mojave 10.14.6
Xcode version: 11.2.1 (11B500)

Ionic info:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.1

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2 
    ios-sim           : 6.0.0 
    Node              : v8.9.1
    npm               : 5.8.0 
    OS                : macOS
    Xcode             : Xcode 11.2.1 Build version 11B500 

Environment Variables:

    ANDROID_HOME : /Users/onbitlabs/Library/Android/sdk

Misc:

    backend : pro
cuixi commented 4 years ago

I got this question too, is that ios13 bug ?

sudarshanaonbitlabs commented 4 years ago

Hi all, Any update on this. The issue is still existing. This occurred when selecting video files from gallery but when selecting video from iCloud it is working fine.

EnricoVogt commented 4 years ago

I think its not an ionic bug. Specification says the following:

On getting, conforming user agents must return the total number of bytes

https://w3c.github.io/FileAPI/