|
1 | 1 | <?php
|
2 | 2 | /*
|
3 |
| - * jQuery File Upload Plugin PHP Class 6.0 |
| 3 | + * jQuery File Upload Plugin PHP Class 6.0.1 |
4 | 4 | * https://github.com/blueimp/jQuery-File-Upload
|
5 | 5 | *
|
6 | 6 | * Copyright 2010, Sebastian Tschan
|
@@ -561,9 +561,10 @@ protected function generate_response($content, $print_response = true) {
|
561 | 561 | return;
|
562 | 562 | }
|
563 | 563 | $this->head();
|
564 |
| - if (isset($_SERVER['HTTP_CONTENT_RANGE']) && is_array($content) && |
565 |
| - is_object($content[0]) && $content[0]->size) { |
566 |
| - $this->header('Range: 0-'.($this->fix_integer_overflow(intval($content[0]->size)) - 1)); |
| 564 | + $files = $content[$this->options['param_name']]; |
| 565 | + if (isset($_SERVER['HTTP_CONTENT_RANGE']) && is_array($files) && |
| 566 | + is_object($files[0]) && $files[0]->size) { |
| 567 | + $this->header('Range: 0-'.($this->fix_integer_overflow(intval($files[0]->size)) - 1)); |
567 | 568 | }
|
568 | 569 | $this->body($json);
|
569 | 570 | }
|
@@ -657,9 +658,13 @@ public function get($print_response = true) {
|
657 | 658 | }
|
658 | 659 | $file_name = $this->get_file_name_param();
|
659 | 660 | if ($file_name) {
|
660 |
| - $response = array('file' => $this->get_file_object($file_name)); |
| 661 | + $response = array( |
| 662 | + substr($this->options['param_name'], 0, -1) => $this->get_file_object($file_name) |
| 663 | + ); |
661 | 664 | } else {
|
662 |
| - $response = array('files' => $this->get_file_objects()); |
| 665 | + $response = array( |
| 666 | + $this->options['param_name'] => $this->get_file_objects() |
| 667 | + ); |
663 | 668 | }
|
664 | 669 | return $this->generate_response($response, $print_response);
|
665 | 670 | }
|
@@ -713,7 +718,10 @@ public function post($print_response = true) {
|
713 | 718 | $content_range
|
714 | 719 | );
|
715 | 720 | }
|
716 |
| - return $this->generate_response(array('files' => $files), $print_response); |
| 721 | + return $this->generate_response( |
| 722 | + array($this->options['param_name'] => $files), |
| 723 | + $print_response |
| 724 | + ); |
717 | 725 | }
|
718 | 726 |
|
719 | 727 | public function delete($print_response = true) {
|
|
0 commit comments