<input type="file" accept=".Jpg,.Jpeg" id="uploadCaptureInputFile" class="form-control" name="documents" (change)="onChange($event)" [(ngModel)]="_FileType"
#documents="ngModel">
****************Change Event *************
onChange(event: EventTarget) {
let formData = new FormData();
let eventObj: MSInputMethodContext = <MSInputMethodContext>event;
let target: HTMLInputElement = <HTMLInputElement>eventObj.target;
let files: FileList = target.files;
this.file = files[0];
let formData = new FormData();
formData.append('FileDocument', this.file);
return this.http.post(`UrlPath`, formData)
.map((res: Response) => {
});
}
******************WEB API******************
[HttpPost]
public void GetImage()
{
var ImageData= System.Web.HttpContext.Current.Request.Files["FileDocument"];
ImageData.SaveAs(Path);
}
0 Comments