forked from blueimp/jQuery-File-Upload
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic-plus.html
More file actions
Latest commit
215 lines (215 loc) · 9.88 KB
/
Copy pathbasic-plus.html
File metadata and controls
215 lines (215 loc) · 9.88 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin Basic Plus Demo 1.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
-->
<htmllang="en">
<head>
<!-- Force latest IE rendering engine or ChromeFrame if installed -->
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
<metacharset="utf-8">
<title>jQuery File Upload Demo - Basic Plus version</title>
<metaname="description" content="File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.">
<metaname="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS Toolkit styles -->
<linkrel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap.min.css">
<!-- Generic page styles -->
<linkrel="stylesheet" href="css/style.css">
<!-- Bootstrap styles for responsive website layout, supporting different screen sizes -->
<linkrel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap-responsive.min.css">
<!-- Bootstrap CSS fixes for IE6 -->
<!--[if lt IE 7]><link rel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap-ie6.min.css"><![endif]-->
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<linkrel="stylesheet" href="css/jquery.fileupload-ui.css">
</head>
<body>
<divclass="navbar navbar-fixed-top">
<divclass="navbar-inner">
<divclass="container">
<aclass="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<spanclass="icon-bar"></span>
<spanclass="icon-bar"></span>
<spanclass="icon-bar"></span>
</a>
<aclass="brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a>
<divclass="nav-collapse">
<ulclass="nav">
<liclass="active"><ahref="http://blueimp.github.com/jQuery-File-Upload/">Demo</a></li>
<li><ahref="https://github.com/blueimp/jQuery-File-Upload#download">Download</a></li>
<li><ahref="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li>
<li><ahref="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li>
<li><ahref="https://github.com/blueimp/jQuery-File-Upload#support">Support</a></li>
<li><ahref="https://blueimp.net">© Sebastian Tschan</a></li>
</ul>
</div>
</div>
</div>
</div>
<divclass="container">
<divclass="page-header">
<h1>jQuery File Upload Demo</h1>
<h2class="lead">Basic Plus version</h2>
<ulclass="nav nav-tabs">
<li><ahref="basic.html">Basic</a></li>
<liclass="active"><ahref="basic-plus.html">Basic Plus</a></li>
<li><ahref="index.html">Basic Plus UI</a></li>
<li><ahref="angularjs.html">AngularJS</a></li>
</ul>
<blockquote>
<p>File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery.<br>
Supports cross-domain, chunked and resumable file uploads and client-side image resizing.<br>
Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p>
</blockquote>
</div>
<!-- The fileinput-button span is used to style the file input field as button -->
<spanclass="btn btn-success fileinput-button">
<iclass="icon-plus icon-white"></i>
<span>Add files...</span>
<!-- The file input field used as target for the file upload widget -->
<inputid="fileupload" type="file" name="files[]" multiple>
</span>
<br>
<br>
<!-- The global progress bar -->
<divid="progress" class="progress progress-success progress-striped">
<divclass="bar"></div>
</div>
<!-- The container for the uploaded files -->
<divid="files" class="files"></div>
<br>
<divclass="well">
<h3>Demo Notes</h3>
<ul>
<li>The maximum file size for uploads in this demo is <strong>5 MB</strong> (default file size is unlimited).</li>
<li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li>
<li>Uploaded files will be deleted automatically after <strong>5 minutes</strong> (demo setting).</li>
<li>You can <strong>drag & drop</strong> files from your desktop on this webpage with Google Chrome, Mozilla Firefox and Apple Safari.</li>
<li>Please refer to the <ahref="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <ahref="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li>
<li>Built with Twitter's <ahref="http://twitter.github.com/bootstrap/">Bootstrap</a> toolkit and Icons from <ahref="http://glyphicons.com/">Glyphicons</a>.</li>
</ul>
</div>
</div>
<scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<scriptsrc="js/vendor/jquery.ui.widget.js"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<scriptsrc="http://blueimp.github.com/JavaScript-Load-Image/load-image.min.js"></script>
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
<scriptsrc="http://blueimp.github.com/JavaScript-Canvas-to-Blob/canvas-to-blob.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<scriptsrc="js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<scriptsrc="js/jquery.fileupload.js"></script>
<!-- The File Upload processing plugin -->
<scriptsrc="js/jquery.fileupload-process.js"></script>
<!-- The File Upload image preview & resize plugin -->
<scriptsrc="js/jquery.fileupload-image.js"></script>
<!-- The File Upload audio preview plugin -->
<scriptsrc="js/jquery.fileupload-audio.js"></script>
<!-- The File Upload video preview plugin -->
<scriptsrc="js/jquery.fileupload-video.js"></script>
<!-- The File Upload validation plugin -->
<scriptsrc="js/jquery.fileupload-validate.js"></script>
<script>
/*jslint unparam: true */
/*global window, $ */
$(function(){
'use strict';
// Change this to the location of your server-side upload handler:
varurl=(window.location.hostname==='blueimp.github.com'||
window.location.hostname==='blueimp.github.io') ?
'//jquery-file-upload.appspot.com/' : 'server/php/',
uploadButton=$('<button/>')
.addClass('btn')
.prop('disabled',true)
.text('Processing...')
.on('click',function(){
var$this=$(this),
data=$this.data();
$this
.off('click')
.text('Abort')
.on('click',function(){
$this.remove();
data.abort();
});
data.submit().always(function(){
$this.remove();
});
});
$('#fileupload').fileupload({
url: url,
dataType: 'json',
autoUpload: false,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
maxFileSize: 5000000,// 5 MB
loadImageMaxFileSize: 15000000,// 15MB
disableImageResize: false,
previewMaxWidth: 100,
previewMaxHeight: 100,
previewCrop: true
}).on('fileuploadadd',function(e,data){
data.context=$('<div/>').appendTo('#files');
$.each(data.files,function(index,file){
varnode=$('<p/>')
.append($('<span/>').text(file.name));
if(!index){
node
.append('<br>')
.append(uploadButton.clone(true).data(data));
}
node.appendTo(data.context);
});
}).on('fileuploadprocessalways',function(e,data){
varindex=data.index,
file=data.files[index],
node=$(data.context.children()[index]);
if(file.preview){
node
.prepend('<br>')
.prepend(file.preview);
}
if(file.error){
node
.append('<br>')
.append(file.error);
}
if(index+1===data.files.length){
data.context.find('button')
.text('Upload')
.prop('disabled',!!data.files.error);
}
}).on('fileuploadprogressall',function(e,data){
varprogress=parseInt(data.loaded/data.total*100,10);
$('#progress .bar').css(
'width',
progress+'%'
);
}).on('fileuploaddone',function(e,data){
$.each(data.result.files,function(index,file){
varlink=$('<a>')
.attr('target','_blank')
.prop('href',file.url);
$(data.context.children()[index])
.wrap(link);
});
}).on('fileuploadfail',function(e,data){
$.each(data.result.files,function(index,file){
varerror=$('<span/>').text(file.error);
$(data.context.children()[index])
.append('<br>')
.append(error);
});
});
});
</script>
</body>
</html>