Skip to content

Commit

Permalink
Added redirect and redirectParamName options.
Browse files Browse the repository at this point in the history
This allows to set the redirect url for cross-domain iframe transport
uploads, which will be sent to the upload server as form data parameter.
  • Loading branch information
blueimp committed Feb 13, 2012
1 parent 04dc8e6 commit f579677
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js/jquery.fileupload.js
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin 5.6.1
* jQuery File Upload Plugin 5.7
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -75,6 +75,12 @@
limitConcurrentUploads: undefined,
// Set the following option to true to force iframe transport uploads:
forceIframeTransport: false,
// Set the following option to the location of a redirect url on the
// origin server, for cross-domain iframe transport uploads:
redirect: undefined,
// The parameter name for the redirect url, sent as part of the form
// data and set to 'redirect' if this option is empty:
redirectParamName: undefined,
// Set the following option to the location of a postMessage window,
// to enable postMessage transport uploads:
postMessage: undefined,
Expand Down Expand Up @@ -316,6 +322,14 @@
options.dataType = 'iframe ' + (options.dataType || '');
// The iframe transport accepts a serialized array as form data:
options.formData = this._getFormData(options);
// Add redirect url to form data on cross-domain uploads:
if (options.redirect && $('<a></a>').prop('href', options.url)
.prop('host') !== location.host) {
options.formData.push({
name: options.redirectParamName || 'redirect',
value: options.redirect
});
}
},

_initDataSettings: function (options) {
Expand Down

0 comments on commit f579677

Please sign in to comment.