Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for #65 #68

Merged
merged 1 commit into from

2 participants

@wingedfox

Added "Content-Type" header

Example of server-side response for preflight cors request

response.setHeader("Access-Control-Allow-Origin", "*");
if ("options".equals(req.getMethod().toLowerCase())) {
    response.addHeader("Access-Control-Request-Method", "POST");
    response.addHeader("Access-Control-Allow-Headers", "Content-Range, X-Requested-With, Content-Disposition, Content-Type");

    return null;
}
@RubaXa RubaXa merged commit fba1d01 into mailru:dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 12, 2013
  1. Added Content-Type header

    Ilya Lebedev authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +6 −4 lib/FileAPI.Form.js
  2. +1 −0  lib/FileAPI.XHR.js
View
10 lib/FileAPI.Form.js
@@ -92,16 +92,18 @@
queue.inc();
file.blob.toBlob(function (blob){
data.name = file.name;
- data.file = blob;
- data.size = blob.length;
+ data.file = blob;
+ data.size = blob.length;
+ data.type = file.type;
queue.next();
}, 'image/png');
}
else if( file.file ){
//file
data.name = file.blob.name;
- data.file = file.blob;
- data.size = file.blob.size;
+ data.file = file.blob;
+ data.size = file.blob.size;
+ data.type = file.type;
}
else {
// additional data
View
1  lib/FileAPI.XHR.js
@@ -204,6 +204,7 @@
xhr.setRequestHeader("Content-Range", "bytes " + data.start + "-" + data.end + "/" + data.size);
xhr.setRequestHeader("Content-Disposition", 'attachment; filename=' + encodeURIComponent(data.name));
+ xhr.setRequestHeader("Content-Type", data.type || "application/octet-stream");
slice = data.file[slice](data.start, data.end + 1);
Something went wrong with that request. Please try again.