-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·73 lines (61 loc) · 2.32 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!-- Title: Using the jsessionid with the data upload service
Description: The jsessionid lets you explicitly specify the session ID of a request URL.
This specification ensures that the correct session state is preserved for a session when
cookies do not work properly or are not available.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<!-- FME Server Javascript API -->
<script src="http://api.fmeserver.com/js/v1.1/FMEServer.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>File Upload Demo</title>
<script>
$(document).ready(function(){
FMEServer.init({
server : fullForm.host,
token : fullForm.token
});
//Call server and get the session ID and path
FMEServer.getSession(fullForm.repository, fullForm.workspace, function(json){
fullForm.session = json.serviceResponse.session;
fullForm.path = json.serviceResponse.files.folder[0].path;
});
});
var fullForm = {
host : 'https://fmepedia2014-safe-software.fmecloud.com',
token : 'fb1c3ee6828e6814c75512dd4770a02e73d913b8',
session : null,
path : null,
uploadedFileList : null,
repository : 'Samples',
workspace : 'easyTranslator.fmw',
submitForm : function(){
var files = document.getElementById('file');
FMEServer.dataUpload(fullForm.repository, fullForm.workspace, files, fullForm.session, fullForm.updateList);
},
updateList : function(json){
$('#uploadedList').html('');
var fileList = json.serviceResponse.files.file;
//display uploaded files and their paths in the browser to
for (each in fileList){
$('#uploadedList').append('<div>Name: ' + fileList[each].name + '</div>');
$('#uploadedList').append('<div><em>Size: ' + fileList[each].size+ ' bytes</em></div><br />');
};
}
};
</script>
</head>
<body >
<form id="file_upload_form">
<input name="files[]" id="file" size="27" type="file" />
<br />
<input type="button" onclick="fullForm.submitForm();" value="Upload" />
</form>
<br/>
<h3>All Uploaded Files:</h3>
<div id='uploadedList'>
</div>
</body>
</html>