Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed parsing of $_FILES as one-dimensional array.

Thanks to Julien Künzi for the report.
  • Loading branch information...
commit af27fd809ebdbb745c0080fbe3192a3c6bda6aa7 1 parent 33650a9
Sebastian Tschan blueimp authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 server/php/upload.class.php
12 server/php/upload.class.php
View
@@ -1,6 +1,6 @@
<?php
/*
- * jQuery File Upload Plugin PHP Class 5.9
+ * jQuery File Upload Plugin PHP Class 5.9.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
@@ -333,6 +333,8 @@ public function post() {
$_FILES[$this->options['param_name']] : null;
$info = array();
if ($upload && is_array($upload['tmp_name'])) {
+ // param_name is an array identifier like "files[]",
+ // $_FILES is a multi-dimensional array:
foreach ($upload['tmp_name'] as $index => $value) {
$info[] = $this->handle_file_upload(
$upload['tmp_name'][$index],
@@ -346,17 +348,19 @@ public function post() {
);
}
} elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) {
+ // param_name is a single object identifier like "file",
+ // $_FILES is a one-dimensional array:
$info[] = $this->handle_file_upload(
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
isset($_SERVER['HTTP_X_FILE_NAME']) ?
$_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ?
- isset($upload['name']) : null),
+ $upload['name'] : null),
isset($_SERVER['HTTP_X_FILE_SIZE']) ?
$_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ?
- isset($upload['size']) : null),
+ $upload['size'] : null),
isset($_SERVER['HTTP_X_FILE_TYPE']) ?
$_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ?
- isset($upload['type']) : null),
+ $upload['type'] : null),
isset($upload['error']) ? $upload['error'] : null
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.