-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpload.html
48 lines (46 loc) · 1.73 KB
/
Upload.html
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>File Upload Demo</title>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<script>
$(document).ready(function () {
$('#btnUploadFile').on('click', function () {
var data = new FormData()
var files = $("#fileUpload").get(0).files;
// Add the uploaded image content to the form data collection
if (files.length > 0) {
data.append("UploadedImage", files[0]);
}
// Make Ajax request with the contentType = false, and procesDate = false
var ajaxRequest = $.ajax({
type: "POST",
url: "http://localhost:25225/api/Upload/user/PostUserImage",
contentType: false,
processData: false,
data: data
});
ajaxRequest.done(function (xhr, textStatus) { });
});
});
</script>
</head>
<body>
<div id="example">
<div class="demo-section k-header">
<h3>Image Upload</h3>
<br />
<div>
<label for="fileUpload">
Select File to Upload:
<input id="fileUpload" type="file" name="files" />
<br />
<br />
<input id="btnUploadFile" type="button" value="Upload File" class="btn-primary" />
</div>
</div>
</div>
</div>
</body>
</html>