-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileAttachment.js
26 lines (25 loc) · 1.19 KB
/
FileAttachment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$('#FileSend').click(function() {
var files = document.getElementById('FileUpload').files;
var AttachmentData =new FormData();
for (var i = 0; i < files.length; i++) {
AttachmentData.append(files[i].name, files[i]);
}
AttachmentData.append('EmailTo', document.getElementById('txtSendTo').value);
AttachmentData.append('EmailCC', document.getElementById('txtSendCC').value);
AttachmentData.append('EmailBCC', document.getElementById('txtSendBCC').value);
AttachmentData.append('EmailSubject', document.getElementById('txtSubject').value);
AttachmentData.append('EmailMessage', document.getElementById('txtMessage').value);
$.ajax({
url: '/Home/SendEmail',
type: "POST",
contentType: false, // Not to set any content header
processData: false, // Not to process data
data: AttachmentData,
success: function (result) {
alert(result);
},
error: function (err) {
alert(err);
}
});
});