Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File type input does not work in Capacitor V3 - Android #5794

Closed
EdissonG opened this issue Jul 27, 2022 · 4 comments
Closed

File type input does not work in Capacitor V3 - Android #5794

EdissonG opened this issue Jul 27, 2022 · 4 comments
Labels
needs reproduction needs reproducible example to illustrate the issue

Comments

@EdissonG
Copy link

Hi,

File type input does not work in capacitor v3

Capacitor Version V3 - Ionic V6

I'm using input type file and the way to upload files, I'm doing it natively with Javascript, and it works fine on web, but when I'm going to use it on Android it doesn't upload any files:

video5116480267824923277.mp4
<button type="button" mat-raised-button (click)="fileInput.click()">{{ field.label }}</button>
<input hidden type="file" onclick="this.value = null" (change)="onFileChange($event)" capture #fileInput>

I don't understand why it doesn't work if Ionic is really supposed to be running HTML, and I'm also using Ckeditor V5, and it has the same problem. Likewise, I talked to an acquaintance, and he told me he has the same issue and he thinks it's because of the Web View.

The only solutions I see is to use plugins :/ and I don't know which ones to use and logically Ckeditor would keep the issue.

@jcesarmobile jcesarmobile added the needs reproduction needs reproducible example to illustrate the issue label Jul 27, 2022
@Ionitron
Copy link
Collaborator

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks!
Ionitron 💙

@Ionitron Ionitron added the needs reply needs reply from the user label Jul 27, 2022
@EdissonG
Copy link
Author

EdissonG commented Jul 28, 2022

Hi,

I really do not see that it is necessary to replicate the case when it is evident that it is a bug(I'm sure) or if there is any possible solution may already happen to someone because I do not think it is the only case.

I attach a video where it is clearly evidenced that on PC it works

PC.Input.File.vs.Android.Bug.Input.type.File.mp4

Update
I was checking with clg and I see that it does not enter reader.onload :(

let reader = new FileReader();
reader.readAsDataURL(file);
console.log(reader);
reader.onload = async () => {
        console.log('I am here');
}

And also the solution is to look for a third party plug-in that solves it :(.

Thank you.

@Ionitron Ionitron removed the needs reply needs reply from the user label Jul 28, 2022
@EdissonG
Copy link
Author

Hi,

Solved :D

I was helped by the solution of @tripodsgames
#1564

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction needs reproducible example to illustrate the issue
Projects
None yet
Development

No branches or pull requests

3 participants