TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rahul Kumar
NA
43
9.3k
How to Import Excel into SQL In Angular 5
Aug 28 2018 5:29 AM
HTML:
<form class="form-horizontal" [formGroup]="UploadCodeBlockExcelForm" (submit)="onSubmit()" novalidate>
<div class="box-body">
<fieldset>
<div class="row">
<div class="col-md-2 upload">
<label>Upload Excel :</label>
</div>
<div class="col-md-3">
<input type="file" formControlName="FileUpload" id="uploadexcel" (change)="UploadExcel($event)" accept=".xlsx" />
</div>
<div class="col-md-5"></div>
<div class="col-md-3">
<!--[disabled]="!firmForm.valid"-->
<input type="submit" class="btn btn-info" value="Upload" name="submit"/>
<!--<button type="submit" class="btn btn-secondary">Save</button>
<button type="button" routerLink="/" class="btn btn-secondary">Cancel</button>-->
</div>
</div>
<div> </div>
</fieldset>
</div>
</form>
UploadExcel(event) {
debugger;
let fileReader = new FileReader();
this.file = event.target.files[0];
var filename = this.file.name;
if (event.target.files && event.target.files.length > 0) {
let file = event.target.files[0];
fileReader.readAsDataURL(file);
fileReader.onload = () => {
this.UploadCodeBlockExcelForm.get('uploadexcel').setValue({
filename: file.name,
filetype: file.type,
value: fileReader.result.slice(0)
})
};
}
}
onSubmit(filename) {
const formModel = this.UploadCodeBlockExcelForm.value;
//this.loading = true;
// In a real-world app you'd have a http request / service call here like
// this.http.post('apiUrl', formModel)
setTimeout(() => {
console.log(formModel);
alert('done!');
//this.loading = false;
}, 1000);
}
Reply
Answers (
1
)
how should i add search box to my mvc app like our c# corner
How to connect SFTP from Azure Websites