Skip to content

Commit 7a77673

Browse files
committed
Pass the file type as contentType argument to the Blob.slice call.
Remove the obsolete Content-Description header, which isn't necessary anymore to transfer the file type for Blob uploads.
1 parent 54d8243 commit 7a77673

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

js/jquery.fileupload.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin 5.19.6
2+
* jQuery File Upload Plugin 5.19.7
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -341,7 +341,6 @@
341341
if (options.blob) {
342342
options.headers['Content-Disposition'] = 'attachment; filename="' +
343343
encodeURI(file.name) + '"';
344-
options.headers['Content-Description'] = encodeURI(file.type);
345344
formData.append(paramName, options.blob, file.name);
346345
} else {
347346
$.each(options.files, function (index, file) {
@@ -527,7 +526,8 @@
527526
o.blob = slice.call(
528527
file,
529528
ub,
530-
ub + mcs
529+
ub + mcs,
530+
file.type
531531
);
532532
// Store the current chunk size, as the blob itself
533533
// will be dereferenced after data processing:

server/php/UploadHandler.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* jQuery File Upload Plugin PHP Class 5.19
3+
* jQuery File Upload Plugin PHP Class 5.19.1
44
* https://github.com/blueimp/jQuery-File-Upload
55
*
66
* Copyright 2010, Sebastian Tschan
@@ -59,8 +59,7 @@ function __construct($options = null, $initialize = true) {
5959
'access_control_allow_headers' => array(
6060
'Content-Type',
6161
'Content-Range',
62-
'Content-Disposition',
63-
'Content-Description'
62+
'Content-Disposition'
6463
),
6564
// Enable to provide file downloads via GET requests to the PHP script:
6665
'download_via_php' => false,
@@ -678,8 +677,6 @@ public function post($print_response = true) {
678677
'',
679678
$_SERVER['HTTP_CONTENT_DISPOSITION']
680679
)) : null;
681-
$file_type = isset($_SERVER['HTTP_CONTENT_DESCRIPTION']) ?
682-
$_SERVER['HTTP_CONTENT_DESCRIPTION'] : null;
683680
// Parse the Content-Range header, which has the following form:
684681
// Content-Range: bytes 0-524287/2000000
685682
$content_range = isset($_SERVER['HTTP_CONTENT_RANGE']) ?
@@ -694,7 +691,7 @@ public function post($print_response = true) {
694691
$upload['tmp_name'][$index],
695692
$file_name ? $file_name : $upload['name'][$index],
696693
$size ? $size : $upload['size'][$index],
697-
$file_type ? $file_type : $upload['type'][$index],
694+
$upload['type'][$index],
698695
$upload['error'][$index],
699696
$index,
700697
$content_range
@@ -709,8 +706,8 @@ public function post($print_response = true) {
709706
$upload['name'] : null),
710707
$size ? $size : (isset($upload['size']) ?
711708
$upload['size'] : $_SERVER['CONTENT_LENGTH']),
712-
$file_type ? $file_type : (isset($upload['type']) ?
713-
$upload['type'] : $_SERVER['CONTENT_TYPE']),
709+
isset($upload['type']) ?
710+
$upload['type'] : $_SERVER['CONTENT_TYPE'],
714711
isset($upload['error']) ? $upload['error'] : null,
715712
null,
716713
$content_range

0 commit comments

Comments
 (0)