Skip to content

Commit 3bb6d7b

Browse files
committed
Added forceIframeDownload option.
1 parent dc41bd9 commit 3bb6d7b

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

example/application.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin JS Example 4.3.1
2+
* jQuery File Upload Plugin JS Example 4.3.2
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -13,11 +13,19 @@
1313

1414
$(function () {
1515
$('#file_upload').fileUploadUIX({
16+
// The url to the upload handler script (required):
1617
url: 'upload.php',
18+
// The url path to the uploaded files directory (required):
1719
uploadDir: 'files/',
20+
// The url path to the thumbnail pictures directory (required):
1821
thumbnailsDir: 'thumbnails/',
22+
// Wait for user interaction before starting uploads:
1923
autoUpload: false,
24+
// Blob size setting for chunked uploads (remove or set to null to disable):
2025
maxChunkSize: 10000000,
21-
continueAbortedUploads: true
26+
// Request uploaded filesize prior upload and upload remaining bytes:
27+
continueAbortedUploads: true,
28+
// Open download dialogs via iframes, to prevent aborting current uploads:
29+
forceIframeDownload: true
2230
});
2331
});

example/jquery.fileupload-uix.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
this.uploadDir = this.thumbnailsDir = null;
5050
this.autoUpload = true;
5151
this.continueAbortedUploads = false;
52+
this.forceIframeDownload = false;
5253
this.dropZone = container.find('form:first');
5354
this.uploadTable = container.find('.files:first');
5455
this.downloadTable = this.uploadTable;
@@ -179,14 +180,16 @@
179180
};
180181

181182
this.initDownloadHandler = function () {
182-
// Open download dialogs via iframes, to prevent aborting current uploads:
183-
uploadHandler.downloadTable.find('a:not([target="_blank"])')
184-
.live('click', function () {
185-
$('<iframe style="display:none;"/>')
186-
.attr('src', this.href)
187-
.appendTo(container);
188-
return false;
189-
});
183+
if (uploadHandler.forceIframeDownload) {
184+
// Open download dialogs via iframes, to prevent aborting current uploads:
185+
uploadHandler.downloadTable.find('a:not([target="_blank"])')
186+
.live('click', function (e) {
187+
$('<iframe style="display:none;"/>')
188+
.attr('src', this.href)
189+
.appendTo(container);
190+
e.preventDefault();
191+
});
192+
}
190193
};
191194

192195
this.initDeleteHandler = function () {

0 commit comments

Comments
 (0)