Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49237

Ionic 4 how to get file content from ?

$
0
0

@Cmolnar wrote:

Hello all,
I need to code a file-upload for the Browser-Version of my App.
I am trying to use an default like:

<ion-item>
                    <ion-input [ngModel]="video.file" id="video" name="file" type="file" accept="video/*"(ionChange)="fileChangeListener($event)"></ion-input>
</ion-item>

but somehow i can not get the file contents in any way.
I tried the (ionChange)$event but it only contains the fakepath. No files[] anywhere (not in srcElement or traget or anywhere else)
The ngModel never is set, it is allways ‘undefined’.
When i use <form (ngSubmit)="addVideo($event)"> to get the form data I still don’t get any file contents and the ngModel is still ‘undefined’

what am I Missing?
I need to upload this file with FormData() and HttpClient from ‘@angular/common/http’
but that expects a Blob and i can’t even get a base64 string or ArrayBuffer anywhere

greeting and thank you,
this is probably a pretty stupid question but I am already working on this for 1 Day and can not get it.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49237

Trending Articles



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