This repository was archived by the owner on Nov 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathupgrading-to-4.html
352 lines (271 loc) · 25.3 KB
/
upgrading-to-4.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
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<title>Upgrading to 4.x | Fine Uploader Documentation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="icon" href="/favicon.ico">
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Maven+Pro:700,400' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/branch/master/_static/css/main.css" />
<link rel="stylesheet" href="/branch/master/_static/css/pygments.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse" aria-label="mobile navigation menu">
<span class="hide">mobile navigation menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a class="brand" href="http://fineuploader.com/"><img style="margin-top: -10px; height: 20px" src="https://fineuploader.com/img/FineUploader_logo.png" alt="Fine Uploader logo"></a></li>
<li><a href="/branch/master">Docs</a></li>
<li><a href="https://blog.fineuploader.com/">Blog</a></li>
<li class="dropdown">
<button id="features-menu-trigger" class="dropdown-toggle btn btn-link" data-toggle="dropdown">Features <b class="caret"></b></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="features-menu-trigger">
<li role="presentation"><a role="menuitem" href="/branch/master/features/async-tasks-and-promises.html">Async Tasks & Promises</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/azure.html">Azure Blob Storage Uploads</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/cancellable-uploads.html">Cancelling</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/chunking.html">Chunking</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/concurrent-chunking.html">Concurrent Chunking</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/CORS.html">CORS</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/delete.html">Delete</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/drag-and-drop.html">Drag and Drop</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/handling-errors.html">Error Handling</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/modules.html">ES6 & CommonJS Support</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/filename-edit.html">Filename Editing</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/forms.html">Form Support</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/session.html">Initial File Lists</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/extra-buttons.html">Multiple Upload Buttons</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/no-server-uploads.html">No-Server Uploads</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/paste-to-upload.html">Paste</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/pause.html">Pause In-Progress Uploads</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/progress-bars.html">Progress Bars</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/thumbnails.html">Previews & Thumbnails</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/request-parameters.html">Request Parameters</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/resume.html">Resuming</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/retry.html">Retrying</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/s3.html">S3 Uploads</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/statistics-and-status-updates.html">Stats & Status</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/styling.html">Styling</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/upload-files.html">Uploading</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/scaling.html">Upload Scaled Images</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/upload-from-mobile-camera.html">Upload via Mobile Camera</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/validation.html">Validation</a></li>
</ul>
</li>
<li class="dropdown">
<button id="api-menu-trigger" class="dropdown-toggle btn btn-link" data-toggle="dropdown">API <b class="caret"></b></button>
<ul class="dropdown-menu api" role="menu" aria-labelledby="api-menu-trigger">
<li><b>Options</b></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/options.html">Core</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/options-ui.html">UI</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/options-s3.html">S3</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/options-azure.html">Azure</a></li>
<li class="divider"></li>
<li><b>Methods</b></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/methods.html">Core & UI</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/methods-s3.html">S3</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/methods-azure.html">Azure</a></li>
<li class="divider"></li>
<li><b>Events</b></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/events.html">Core & UI</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/api/events-s3.html">S3</a></li>
<li class="divider"></li>
<li role="presentation"><a role="menuitem" style="margin-left: -20px;" href="/branch/master/api/qq.html">Utilities</a></li>
</ul>
</li>
<li class="dropdown">
<button id="servers-dropdown-trigger" class="dropdown-toggle btn btn-link" data-toggle="dropdown">Servers <b class="caret"></b></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="servers-dropdown-trigger">
<li role="presentation"><a role="menuitem" href="/branch/master/endpoint_handlers/traditional.html">Traditional</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/endpoint_handlers/amazon-s3.html">Amazon S3</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/endpoint_handlers/azure.html">Azure Blob Storage</a></li>
</ul>
</li>
<li class="dropdown">
<button id="support-dropdown-trigger" class="dropdown-toggle btn btn-link" data-toggle="dropdown">Support <b class="caret"></b></button>
<ul class="dropdown-menu support" role="menu" aria-labelledby="support-dropdown-trigger">
<li role="presentation"><a role="menuitem" href="/branch/master/browser-support.html">Browsers</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/faq.html">FAQ</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master/features/handling-errors.html">Handling Errors</a></li>
</ul>
</li>
<li class="dropdown">
<button id="version-dropdown-trigger" class="dropdown-toggle btn btn-link" data-toggle="dropdown">Version <b class="caret"></b></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="version-dropdown-trigger">
<li role="presentation"><a role="menuitem" href="/branch/master">Current: 5.16.2</a></li>
<li role="presentation"><a role="menuitem" href="/branch/master">Stable</a></li>
<li role="presentation"><a role="menuitem" href="/branch/develop">In Progress</a></li>
<li role="presentation">
<form class="tag-chooser">
<input class="tag-input" name="tag" placeholder="5.4.0">
<button class="btn btn-info">Go</button>
</form>
</li>
</ul>
</li>
</ul>
<form method="get" id="search" action="https://duckduckgo.com/" class="navbar-form pull-right">
<input type="hidden" name="sites" value="docs.fineuploader.com/branch/master"/>
<!-- Header -->
<input type="hidden" name="kj" value="#0088CC"/>
<!-- Background -->
<input type="hidden" name="k7" value="#FFFFFF"/>
<!-- Text -->
<input type="hidden" name="k8" value="#444444"/>
<!-- Links -->
<input type="hidden" name="k9" value="#0088CC"/>
<!-- Visited Links -->
<input type="hidden" name="kaa" value="#0088CC"/>
<!-- URLS -->
<input type="hidden" name="kx" value="#F87436"/>
<!-- Font -->
<input type="hidden" name="kt" value="h"/>
<input type="text" name="q" maxlength="255" placeholder="Search…" class="span2" title="search documentation" style="margin-top: 4px;"/>
<input type="submit" value="DuckDuckGo Search" style="visibility: hidden; width: 0;" />
</form>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class='row-fluid'>
<div class="span2 sidebar">
</div>
<div class="span9 content">
<span class="pull-right version-number"><p>5.16.2</p></span>
<h1 class="page-header" id="upgrading-to-4x">Upgrading to 4.x</h1>
<p>The 4.0 version brings some breaking changes, mostly surrounding <a href="features/styling.html">templating</a>
in <a href="modes/ui.html">Fine Uploader UI</a>. If you are not using Fine Uploader UI or the <a href="features/drag-and-drop.html#drag-and-drop-standalone-module">standalone drag & drop module</a>,
you will not be affected by these changes.</p>
<p>Be sure to read about templating in the <a href="features/styling.html">styling guide</a>.</p>
<h2 id="fine-uploader-ui-breaking-changes-upgrade-instructions">Fine Uploader UI breaking changes & upgrade instructions</h2>
<p>Templating has been a mess in Fine Uploader UI for quite some time, arguably since day 1. The goal was to clean up
this mess in 4.0 so that integrators/designers could more easily customize the look and feel of UI mode without
resorting to core mode and developing a custom UI from scratch. There will likely still be some cases where it makes
more sense to drop back to Fine Uploader Core and develop a new UI from scratch, but the improvements to templating
in UI mode should make that scenario much less likely.</p>
<p>At a high level, the template markup was moved out of the
javascript source and into the document. You will need to, at least, include the default template bundled with Fine
Uploader in your document. This step made many <code>classes</code> and <code>text</code> option properties redundant as well, so appropriate
properties were removed. What follows is a more detailed description of these breaking changes, along with instructions
that should make the upgrade process from a 3.x build a bit easier.</p>
<h3 id="changed-template-option-to-take-an-id-string-or-element-pointing-to-script-tag-containing-template">Changed <code>template</code> option to take an ID (string) or element (pointing to script tag containing template)</h3>
<p>Previously, the <code>template</code> option contained the top-level template markup (sans the file list markup) as a string.
If you wanted to change this, you needed to copy and paste this unwieldy string into your glue code and make appropriate
changes. You also had to be careful about changing any of the CSS classes assigned to these template items. If any
CSS class was removed/renamed, you had to be sure to update the associated <code>classes</code> option property, since Fine Uploader
UI used the same CSS classes for selection and styling.</p>
<p>In version 4.0, the <code>template</code> option expects either a string or an <code>Element</code> as a value (or a <code>jQuery</code> object if using
the jQuery plug-in wrapper). You may either specify the ID of the container element in your document that contains
the template markup, or you may select the container element yourself. The default value is a string: "qq-template".</p>
<p>The default template HTML file that is bundled with Fine Uploader contains a <code><script></code> with an ID of "qq-template" along
with all supported template items. You can drop this into your document without any changes, and Fine Uploader UI
will work just as it did before. If you want to further customize the template, you can make appropriate changes to
the markup in the <code><script></code> template contents. You can remove almost any item in the template if you don't want it
to be rendered in the DOM. Note that each template item has a CSS class that ends in "-selector" which is used internally
for selecting the item. A second CSS class may be present on the item, used only for styling. You can remove this second
CSS class without fear of breaking the uploader. If you remove the "-selector" CSS class, Fine Uploader will simply
ignore the item, though it will still render in the DOM.</p>
<h3 id="removed-the-filetemplate-option">Removed the <code>fileTemplate</code> option</h3>
<p>The contents of the old <code>template</code> and <code>fileTemplate</code> options have been combined into one template, which must be
included as a <code><script></code> tag with a type of "text/template" in your document (or any hidden container element).
You can use the template contained in the included <code>default.html</code> file in the <code>templates</code> directory as-is,
or modify it to match your application.</p>
<h3 id="template-must-be-included-in-document-script-tag-for-fine-uploader-ui">Template must be included in document script tag for Fine Uploader UI</h3>
<p>As mentioned previously, even if you did not make any adjustments to the default <code>template</code> or <code>fileTemplate</code> options
in older versions of Fine Uploader UI, you still must include a template in your document. A default template is
now bundled with Fine Uploader. You can use the bundled HTML file, or copy and paste the template <code><script></code> tag
into your document.</p>
<h3 id="various-changes-to-the-bundled-css-file">Various changes to the bundled CSS file</h3>
<p>There were a few styling-related changes made to the CSS file that ships with the library.</p>
<p>A <code>.qq-hide</code> style, which defaults to <code>display: none;</code> was also added. You can override this default style
via increased specificity, or you can contribute a new value for this CSS class that Fine Uploader will assign
to any element that it needs to hide. See the <code>classes</code> option in the <a href="features/styling.html">styling guide</a>
for more details.</p>
<p>The <code>.qq-upload-finished</code> style was removed, as this did not appear to serve a useful purpose anymore.</p>
<h3 id="removed-retryshowbutton">Removed <code>retry.showButton</code></h3>
<p>If you do not want the retry button displayed next to each file automatically when a manual retry is possible,
simply omit the retry-related element from your template.</p>
<h3 id="removed-editfilenameenabled">Removed <code>editFilename.enabled</code></h3>
<p>If you do not want to utilize the edit filename feature, either ensure the <code>autoUpload</code> option is set to true
(this is the default) or remove the edit-filename related elements from your template. Currently, this involves removing
the "qq-edit-filename-icon-selector" and "qq-edit-filename-selector" elements.</p>
<h3 id="removed-all-classes-option-properties-other-than-the-ones-listed-in-styling-doc">Removed all <code>classes</code> option properties, other than the ones listed in styling doc</h3>
<p>In most cases, there is no longer any need to define options for each class associated with a UI-mode template item.
Remember, Fine Uploader UI 4.0's default template includes a "-selector" class on each template item specifically for
selecting the item, and another for styling. You can remove or rename the styling class without fear of breaking the
uploader. In fact, omitting most template items is possible as well. The only <code>classes</code> properties that remain are
ones that are added by Fine Uploader dynamically/on-demand. You can override any of these default values if you'd like
to use one of your own custom CSS classes instead.</p>
<h3 id="added-classeshide">Added <code>classes.hide</code></h3>
<p>Part of the 4.0 template rework included a push to stop assigning/changing style attributes on template items in the
javascript code directly. Previously, if Fine Uploader UI wanted to hide an element, it would add a <code>display: none;</code>
style attribute value to the element, and then change this <code>display</code> property to a variable appropriate value when
it was time to display the element again. As of 4.0, to hide an element, Fine Uploader adds a <code>qq-hide</code> CSS class to
the element, which is defined with a default style of <code>display: none;</code> in the bundled CSS file. When the element must
be visible again, this class is removed. You can override the default CSS class name for hiding elements via
<code>classes.hide</code>.</p>
<p>Note that the standalone drag & drop module (which is also used internally by Fine Uploader UI) still sets a <code>display: none;</code>
style directly on drop zones when they must be hidden, and changes this to <code>display: block;</code> to make them visible again.
This was left alone, as we didn't want to break all Fine Uploader Core mode apps that do not include Fine Uploader UI's
default CSS file (since there has never been a dependency on this file when using core mode).</p>
<h3 id="removed-all-text-option-properties-except-for-failupload-formatprogress-and-waitingforresponse">Removed all <code>text</code> option properties, except for <code>failUpload</code>, <code>formatProgress</code> and <code>waitingForResponse</code></h3>
<p>Similar to the changes to the <code>classes</code> option, there is no longer a need to have options dedicated to text that
appears with template items in most cases. You can easily change the default text in your template. In cases where
Fine Uploader UI dynamically changes text based on conditions, <code>text</code> options remain for you to adjust if desired.</p>
<h3 id="removed-draganddropdisabledefaultdropzone">Removed <code>dragAndDrop.disableDefaultDropzone</code></h3>
<p>If you want to disable the default drop zone, simply remove the drop zone related element(s) from your template.</p>
<h3 id="removed-draganddrophidedropzones">Removed <code>dragAndDrop.hideDropzones</code></h3>
<p>If you want an extra or default drop zone to remain invisible until an item approaches the drop area, simply include
a <code>qq-hide-dropzone</code> attribute on the drop zone container. The attribute is present on the drop area in the
default template, but it can be removed, of course.</p>
<h2 id="standalone-drag-drop-module-breaking-changes-upgrade-instructions">Standalone drag & drop module breaking changes & upgrade instructions</h2>
<h3 id="removed-hidedropzonesbeforeenter-option-in-standalone-dnd-module-replaced-w-qq-hide-dropzone-attr">Removed <code>hideDropZonesBeforeEnter</code> option in standalone DnD module (replaced w/ qq-hide-dropzone attr)</h3>
<p>This is the only breaking change to the standalone drag & drop module. Instead of specifying a value for a
<code>hideDropZonesBeforeEnter</code> option that either hides all drop zones until an item approaches (or not) you can now control
visibility in this respect per-dropzone via a <code>qq-hide-dropzone</code> attribute on the drop zone container.</p>
</div>
</div>
</div> <!-- /container -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<!--
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
-->
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<script type="text/javascript">
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(100643192);
(function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '//static.getclicky.com/js';
( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
})();
</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/100643192ns.gif" /></p></noscript>
<script src="/branch/master/_static/js/main.js"></script>
<script src="/branch/master/_static/js/navbar.js"></script>
</body>
</html>