Input[type="file"] doesnt work on ios 12.2
Asked Answered
S

2

8

I have application with input type="file" that works on ios 12.1 and previous but not in ios 12.2 (the newest one). Here is the code that I used:

<input ref="input" :accept="accept" type="file" @change="fileSelected">

It doesn't give any error when debug. I read some release document, Apple said they improve security for document and stuff in ios devices but didn't see any line for how to fix. I'm using Framework 7 + Vue + Cordova

Please anyone help? Thank you!

Stretcherbearer answered 1/4, 2019 at 8:1 Comment(12)
What do you mean by doesn't work ?Blond
there is nothing happen when tap into the input fieldStretcherbearer
actually that was about the new ios version treats uiwebkit differently I guess, same this.$refs.input.click(); works on old ones but not in 12.2Stretcherbearer
What is the : before accept ? Could you remove it ?Blond
it's vue syntax tho, you can but I pass a props in it so I used :Stretcherbearer
Does this one work with 12.2 on Safari ? And only with Cordova ?Blond
I have the same problem, using cordova+ng-file-upload (but not vue). did you find a solution?Oreopithecus
@MrJingles87 the problem for me was I triggered the upload file by js, somehow ios 12.2 wont let us trigger upload file by js function, when click directly to the upload button from input[type='file'], it works.Stretcherbearer
@NguyễnKhắcTâm: I can confirm that. The only solution for me was to put transparent file inputs over the normal upload button.Oreopithecus
yeah, for me too, hacky but did the jobStretcherbearer
@MrJingles87 Can you provide an example? We're having this same issue, but not exactly sure on how you implemented your transparent file inputs.Fatuous
just position a normal file input absolute over other upload button and make it transparent: <input style="position: absolute;left: 0;width: 100%;opacity: 0;" type="file" multiple ngf-select="uploadApi.onFileSelect($files)" />Oreopithecus
C
1

This looks like a bug in UIWebview, I solved this problem by replacing UIWebview with WKWebview。

Cofer answered 14/4, 2019 at 8:17 Comment(1)
Please give some code explaination to let others understand answer well.Spindell
L
0

You can Try it

$timeout(function() {
   angular.element(document.querySelector('#example')).triggerHandler('click');
});

instead of

$timeout(function() {
   document.querySelector('#example').click();
});

this bug is replace with IOS 12.1.2 on Iphone XR too

Leila answered 9/4, 2019 at 4:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.