-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIndex.html
42 lines (39 loc) · 1.44 KB
/
Index.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Upload files to server</title>
</head>
<script src="Scripts/jquery-3.1.1.min.js"></script>
<script src="Scripts/jquery.form.min.js"></script>
<script>
$(document).ready(function () {
var options = {
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
// bind to the form's submit event
$('#frmUploader').submit(function () {
$(this).ajaxSubmit(options);
// always return false to prevent standard browser submit and page navigation
return false;
});
});
// pre-submit callback
function showRequest(formData, jqForm, options) {
alert('Uploading is starting.');
return true;
}
// post-submit callback
function showResponse(responseText, statusText, xhr, $form) {
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText );
}
</script>
<body>
<h2>File Upload via Nodejs</h2>
<form id="frmUploader" enctype="multipart/form-data" action="api/Upload/" method="post">
<p><input type="file" name="fileUpload" multiple /></p>
<p><input type="submit" name="submit" id="btnSubmit" value="Upload" /></p>
</form>
</body>
</html>