forked from pqina/filepond
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
65 lines (57 loc) · 2.48 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FilePond Demo</title>
<link href="./dist/filepond.css" rel="stylesheet" />
</head>
<body>
<input type="file" />
<script>
// prettier-ignore
[
{supported: 'Symbol' in window, fill: 'https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js'},
{supported: 'Promise' in window, fill: 'https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js'},
{supported: 'fetch' in window, fill: 'https://cdn.jsdelivr.net/npm/[email protected]/fetch.min.js'},
{supported: 'CustomEvent' in window && 'log10' in Math && 'sign' in Math && 'assign' in Object && 'from' in Array &&
['find', 'findIndex', 'some', 'includes'].reduce(function(previous, prop) { return (prop in Array.prototype) ? previous : false; }, true), fill: 'https://unpkg.com/filepond-polyfill/dist/filepond-polyfill.js'}
].forEach(function(p) {
if (p.supported) return;
document.write('<script src="' + p.fill + '"><\/script>');
});
</script>
<script src="./dist/filepond.js"></script>
<button type="button" id="disable">Disable</button>
<button type="button" id="enable">Enable</button>
<script>
// Get a reference to the file input element
const inputElement = document.querySelector('input[type="file"]');
// Create the FilePond instance
const pond = FilePond.create(inputElement, {
allowMultiple: true,
server: {
load: 'https://i.imgur.com/',
},
files: [
{
source: 'rBkbXS3.jpeg',
options: {
type: 'local',
},
},
],
storeAsFile: true,
disabled: true,
});
// Easy console access for testing purposes
window.pond = pond;
document.querySelector('#disable').onclick = function() {
pond.setOptions({ disabled: true });
};
document.querySelector('#enable').onclick = function() {
pond.setOptions({ disabled: false });
};
</script>
</body>
</html>