-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathindex.html
85 lines (82 loc) · 3.01 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
74
75
76
77
78
79
80
81
82
83
84
85
<!-- Test at http://localjquerysdk.com/ -->
<html>
<head>
<title>Testing the jQuery plugin</title>
</head>
<body>
<form id="upload-form" action="/uploads" enctype="multipart/form-data" method="POST">
<input type="file" name="my_file" multiple="multiple" />
<div class="transloadit-drop-area" data-name="files">Drag and drop files here</div>
<div class="transloadit-file-preview-area"></div>
<input type="text" name="album_id" value="foo_id" />
<input type="submit" value="Upload" />
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="http://localjquerysdk.com/build/jquery.transloadit2-v3-latest.js"></script>
<!-- <script src="https://assets.transloadit.com/js/jquery.transloadit2-v3-latest.js"></script> -->
<script type="text/javascript">
window.YOUR_TRANSLOADIT_AUTH_KEY = 'YOUR_AUTH_KEY'
</script>
<script src="http://localjquerysdk.com/auth_key.js"></script>
<script type="text/javascript">
$(function () {
$('#upload-form').transloadit({
wait: true,
requireUploadMetaData: false,
processZeroFiles: false,
autoSubmit: false,
// service: 'http://vbox.transloadit.com/',
// service: 'http://api2-malaeka.transloadit.com/',
// region: 'eu-west-1',
// assets: 'http://localjquerysdk.com/build/',
triggerUploadOnFileSelection: true,
pollInterval: 2500,
maxNumberOfUploadedFiles: 2,
fields: '*',
translations: {
startingUpload: 'Starting the upload ...',
processingFiles: 'Upload done, now processing files ...',
},
params: {
auth: { key: window.YOUR_TRANSLOADIT_AUTH_KEY },
steps: {
resize_to_75: {
robot: '/image/resize',
use: ':original',
width: 75,
height: 75,
},
},
},
onStart: function (assembly) {
console.log('>>> onStart', assembly)
},
onProgress: function (bytesIn, totalBytes) {
console.log(bytesIn, totalBytes)
},
onSuccess: function (assembly) {
console.log('onSuccess: Assembly finished successfully with', assembly.ok)
},
onExecuting: function () {
console.log('Uploading finished!')
},
onUpload: function (uploadedFile) {
console.log('Upload added', uploadedFile)
},
onResult: function (stepName, result) {
console.log('Result added', stepName, result)
},
onError: function (error) {
console.log('Assembly got an error:', error)
},
onDisconnect: function () {
console.log('Disconnected!')
},
onReconnect: function (error) {
console.log('Reconnected!')
},
})
})
</script>
</body>
</html>