|
344 | 344 | * @param {Element|Array.<Element>} domNodes |
345 | 345 | * @param {boolean} isDirectory Pass in true to allow directories to |
346 | 346 | * @param {boolean} singleFile prevent multi file upload |
| 347 | + * @param {Object} attributes set custom attributes: |
| 348 | + * http://www.w3.org/TR/html-markup/input.file.html#input.file-attributes |
| 349 | + * eg: accept: 'image/*' |
347 | 350 | * be selected (Chrome only). |
348 | 351 | */ |
349 | | - assignBrowse: function (domNodes, isDirectory, singleFile) { |
| 352 | + assignBrowse: function (domNodes, isDirectory, singleFile, attributes) { |
350 | 353 | if (typeof domNodes.length === 'undefined') { |
351 | 354 | domNodes = [domNodes]; |
352 | 355 | } |
|
379 | 382 | if (isDirectory) { |
380 | 383 | input.setAttribute('webkitdirectory', 'webkitdirectory'); |
381 | 384 | } |
| 385 | + each(attributes, function (value, key) { |
| 386 | + input.setAttribute(key, value); |
| 387 | + }); |
382 | 388 | // When new files are added, simply append them to the overall list |
383 | 389 | var $ = this; |
384 | 390 | input.addEventListener('change', function (e) { |
|
1210 | 1216 | if (typeof preprocess === 'function') { |
1211 | 1217 | switch (this.preprocessState) { |
1212 | 1218 | case 0: |
1213 | | - preprocess(this); |
1214 | 1219 | this.preprocessState = 1; |
| 1220 | + preprocess(this); |
1215 | 1221 | return; |
1216 | 1222 | case 1: |
1217 | 1223 | return; |
|
1367 | 1373 | data.append(this.flowObj.opts.fileParameterName, blob); |
1368 | 1374 | } |
1369 | 1375 |
|
1370 | | - this.xhr.open(method, target); |
| 1376 | + this.xhr.open(method, target, true); |
1371 | 1377 | this.xhr.withCredentials = this.flowObj.opts.withCredentials; |
1372 | 1378 |
|
1373 | 1379 | // Add data from header options |
|
1465 | 1471 | * Library version |
1466 | 1472 | * @type {string} |
1467 | 1473 | */ |
1468 | | - Flow.version = '2.4.0'; |
| 1474 | + Flow.version = '2.5.0'; |
1469 | 1475 |
|
1470 | 1476 | if ( typeof module === "object" && module && typeof module.exports === "object" ) { |
1471 | 1477 | // Expose Flow as module.exports in loaders that implement the Node |
|
0 commit comments