file-upload
file-upload copied to clipboard
Bug using headers
Hey I found a bug when using headers.
var url = this.target.replace("<name>", file.name);
xhr.open(this.method, url, true);
for (key in this.headers) {
if (headers.hasOwnProperty(key)) {
xhr.setRequestHeader(key, this.headers[key]);
}
}
Should be:
var url = this.target.replace("<name>", file.name);
xhr.open(this.method, url, true);
for (key in this.headers) {
if (this.headers.hasOwnProperty(key)) {
xhr.setRequestHeader(key, this.headers[key]);
}
}
The change is this.headers in the if-statement. Without this, it'll throw an error that headers is undefined.
Oh great catch! Thanks so much