-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbk.html
39 lines (32 loc) · 987 Bytes
/
bk.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
<html>
<head>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
<form id="form" action="https://vegas.framltd.se/api/media" method="POST" enctype="multipart/form-data">
<input id="file" type="file" name="file" />
<input type="button" id="upload" value="upload" />
</form>
</body>
<script>
$(document).ready(function() {
var $btn = $("#upload");
var $html = $("#form");
$btn.click(function() {
var $form = new FormData();
$form.append('file', $("#file")[0].files[0]);
$.ajax({
url: 'https://vegas.framltd.se/api/media',
type: 'POST',
data: $form,
success:function(data){
console.log(data);
},
cache: false,
contentType: false,
processData: false
});
})
})
</script>
</html>