-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
38 lines (38 loc) · 1.17 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
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.omeka-client.js"></script>
<script type="text/javascript">
function sendForm() {
var client = $.omekaClient( $( "#endpoint" ).val() );
var key = $( "#key" ).val();
var file = $( "#file" )[0].files[0];
var data = {
item: {
id: $( "#item-id" ).val()
}
};
client.setKey( key );
client.postFile( file, data )
.done(function( data ) {
$( "#output" ).text( JSON.stringify( data, null, 2 ) );
})
.fail(function( jqXHR ) {
$( "#output" ).text( jqXHR.responseText );
});
}
</script>
</head>
<body>
<h2>Upload File</h2>
<form enctype="multipart/form-data" method="post">
<p><input type="text" id="endpoint" /> Endpoint</p>
<p><input type="text" id="key" /> Key </p>
<p><input type="text" id="item-id" /> Item ID</p>
<p><input type="file" id="file" required /></p>
<a href="javascript:sendForm()">Post the file!</a>
</form>
<pre id="output"></pre>
</body>
</html>