I would like to send files (.csv and .json) from ionic (browser, angular) to EC2. Below are some of the details that i have tried but none of them are works.
-
I found this File Transfer for iOS but is for iOS.
-
I saw this File Transfer , but I couldn’t get the file path.
-
As far as I concerned, due to security concern, for security reasons browsers do not allow this, i.e. JavaScript in browser has no access to the File System ( source )
-
For File Path provided by ionic, it can only be used on Android.
Below are the code that successfully allow user to browse local directory and select a file.
home.page.ts
fileChange(file) {
this.file = file.target.files[0];
this.file_name = this.file.name;
}
home.page.html
<input type=“file” accept=".csv" style=“display: none” #file (change)=“fileChange($event)”/>
<ion-button (click)=“file.click()”>Browse
I am developing browser, anyone have idea on how to send file to EC2?