Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
forked from mailru/FileAPI
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupport.html
More file actions
Latest commit
110 lines (90 loc) · 2.67 KB
/
Copy pathsupport.html
File metadata and controls
110 lines (90 loc) · 2.67 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head>
<metahttp-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<metahttp-equiv="Content-Type" content="text/html; charset=utf-8">
<metaname="viewport" content="user-scalable=no, width=400, initial-scale=0.8, maximum-scale=0.8" />
<metaname="apple-mobile-web-app-capable" content="yes" />
<metaname="apple-mobile-web-app-status-bar-style" content="yes" />
<metaname="format-detection" content="email=no" />
<metaname="HandheldFriendly" content="true" />
<title>FileAPI :: Support</title>
<script>
// Объект настройки
varFileAPI={
debug: true,// режим отладки
staticPath: './'// путь до флешек
};
</script>
</head>
<body>
<div>Single:</div>
<divclass="js-fileapi-wrapper"></div><inputid="singleFile" type="file" /></div>
<br/>
<div>Multiple:</div>
<divclass="js-fileapi-wrapper"><inputid="multipleFiles" type="file" multiple/></div>
<divid="log" style="border: 1px solid red; padding: 3px; margin: 2px"></div>
<divid="__console" style="font-size: 12px; color: #333;"></div>
<script>
window.console={
_div: document.getElementById('__console'),
log: function(){
this._div.innerHTML+=[].join.call(arguments,' ')+'<br/>';
},
error: function(){
this._div.innerHTML+='<span style="color: red">';
this.log.apply(this,arguments);
this._div.innerHTML+='</span>';
}
};
</script>
<scriptsrc="./FileAPI.min.js"></script>
<script>
(function(){
function_log(txt){
log.innerHTML=txt+'<br/>'+log.innerHTML;
}
function_uploadFiles(files){
if(files.length){
FileAPI.each(files,function(file){
_log(' -> name: '+file.name+', type: '+file.type+', size: '+file.size);
FileAPI.Image(file).get(function(err,image){
if(err){
_log('error: '+file.name+' -- '+err)
}
else{
document.body.appendChild(image);
}
});
});
FileAPI.upload({
url: 'http://rubaxa.org/FileAPI/server/ctrl.php',
files: {test: files},
complete: function(err){
if(err){
_log('upload failed: '+err)
}else{
_log('files uploaded!');
}
}
});
}
else{
_log('Files not selected');
}
}
FileAPI.event.on(singleFile,'change',function(){
varfiles=FileAPI.getFiles(singleFile);
_uploadFiles(files);
});
FileAPI.event.on(multipleFiles,'change',function(){
varfiles=FileAPI.getFiles(multipleFiles);
_uploadFiles(files);
});
FileAPI.each(FileAPI.support,function(val,key){
_log('FileAPI.support.'+key+': '+val);
});
})();
</script>
</body>
</html>