How can I download (.exe file which is in root path) and Upload a file from Angular 4?
I am new to Angular4 and typescript and .NET Core Web API.
I h
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-praveen',
templateUrl: './praveen.component.html',
styleUrls: ['./praveen.component.css']
})
export class PraveenComponent implements OnInit {
constructor(private httpClient:HttpClient) { }
uploadForm = new FormGroup ({
file1: new FormControl()
});
filedata:any;
fileEvent(e){
this.filedata=e.target.files[0];
console.log(e);
}
onSubmit() {
let formdata = new FormData();
console.log(this.uploadForm)
formdata.append("avatar",this.filedata);
this.httpClient
.post("http://localhost:3040/uploading",formdata)
.subscribe((res)=>{console.log(res});
}
ngOnInit() {
}
}