-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathimportgame.html
47 lines (36 loc) · 1.07 KB
/
importgame.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
<html>
<body>
<input type="text" id="user_id" /> User Id <br />
<input type="text" id="auth_key" /> Auth Key <br />
<input type="file" id="uploadfile" name="uploadfile" /> <br />
<input type="button" value="upload" onclick="upload()" /> <br />
<script>
function upload(evt)
{
var file = document.getElementById("uploadfile").files[0];
var reader = new FileReader();
reader.onload = function(evt)
{
var data = {};
var zip_data = evt.target.result;
zip_data = zip_data.substr(zip_data.indexOf(",")+1);
data.auth = {};
data.auth.user_id = document.getElementById("user_id").value;
data.auth.key = document.getElementById("auth_key").value;
data.zip_data = zip_data;
data.zip_name = file.name;
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onload = function(evt)
{
xmlhttp.responseText;
}
xmlhttp.open("POST","./json.php/v2.duplicate.importGame");
xmlhttp.setRequestHeader("Content-type","application/json");
xmlhttp.send(JSON.stringify(data));
}
reader.readAsDataURL(file);
}
</script>
</body>
</html>