Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix uploading files using drag 'n drop #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions js/prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -1762,8 +1762,16 @@ Ajax.Request = Class.create(Ajax.Base, {
};

if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
/* For an XHR to properly post a multipart/form-data
* it's crucial that the Content-type header is set by
* the browser itself for the boundary to be correct.
* A script must explicitly set contentType to 'false'
* in this case so we don't set the Content-Type header.
*/
if (this.options.contentType!=false) {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
}

/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
Expand Down