Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Input type file not opening dialog

$
0
0

@Shivendra-Parmar wrote:

Hi,
I have used ion-input with type=“file” but when I click on that to upload a file It does not open the file dialog and following warning comes:
File chooser dialog can only be shown with user activation.
I looked around and found out some solutions that show using the button to trigger the click for dialog
but It didn’t work possibly I am doing something wrong,
Here is my code:

<ion-input type="file" accept="jpg, png, jpeg" [(ngModel)] = "file" (change) = "addImage($event, 'card')" required #cardPicker></ion-input>
<ion-button fill="clear" (click)="cardPicker.click()" class="dialog">Add card Image</ion-button>

I have also tried native input element with following code but that also did not help

<input type="file" #card>
<button class="dialog" (click)="card.click()">Add card Image</button>

What I am doing wrong?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>