Input file basic question

Hi, i am using the following to prompt the user to select a file but seems like the function is not called. does ng-change work with input type=file?
thanks!

 <div class="row">
            <input type="file"
                ng-model="fileName"
                ng-change="uploadRoster(fileName)" />

all i need to do is prompt the user to select a .csv file and read it as a string. thanks in advance!

there is no ng-model binding on file inputs in angular IIRC

1 Like

thanks -that worked. I am getting the file name now.
which way is better to read the file - through http or using the cordova file plugin?
by better i mean mostly easier . File is expected to be store in Downloads or Documents or some other common shared location.

thanks in advance

I’m not sure I understand your question. You just want to upload the file somewhere? I’m not familiar with cordova plugins for this, but usually it’s just a post request wiith the file data to your backend and you can then persist the file somewhere on your server or push to S3 or whatever.

I just want to ask the user to select a file ( i get the file now correct) and then i want to read its content. I am using $http for now and it seems to work ok.