-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.html
More file actions
37 lines (36 loc) · 968 Bytes
/
test.html
File metadata and controls
37 lines (36 loc) · 968 Bytes
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
<!doctype html>
<html>
<head>
<title>Testing file upload</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
</head>
<body>
<form class="test">
<label for="Language">Language:</label><br />
<input type="text" name="Language" class="language"><br />
<label for="TemplateTitle">Template Title:</label><br />
<input type="text" name="TemplateTitle" class="templatetitle"><br />
<input type="file" name="file[]" class="file" multiple><br />
<input type="submit" name="submit" value="Submit">
</form>
<script>
$('.test').on('submit', (e) => {
e.preventDefault();
var form = $('.test')[0];
var formData = new FormData(form);
$.ajax({
url: '/API/UploadTemplate.php',
data: formData,
type: 'POST',
contentType: false,
processData: false,
success: function (data) {
if(data.Success) {
alert('Upload complete!');
}
}
});
});
</script>
</body>
</html>