Skip to content

Commit 6417729

Browse files
committed
Allow query parameters in the script URL. Closes blueimp#1999.
1 parent bd351d3 commit 6417729

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

server/php/UploadHandler.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* jQuery File Upload Plugin PHP Class 6.1
3+
* jQuery File Upload Plugin PHP Class 6.1.1
44
* https://github.com/blueimp/jQuery-File-Upload
55
*
66
* Copyright 2010, Sebastian Tschan
@@ -166,9 +166,15 @@ protected function get_upload_path($file_name = null, $version = null) {
166166
.$version_path.$file_name;
167167
}
168168

169+
protected function get_query_separator($url) {
170+
return strpos($url, '?') === false ? '?' : '&';
171+
}
172+
169173
protected function get_download_url($file_name, $version = null) {
170174
if ($this->options['download_via_php']) {
171-
$url = $this->options['script_url'].'?file='.rawurlencode($file_name);
175+
$url = $this->options['script_url']
176+
.$this->get_query_separator($this->options['script_url'])
177+
.'file='.rawurlencode($file_name);
172178
if ($version) {
173179
$url .= '&version='.rawurlencode($version);
174180
}
@@ -181,7 +187,8 @@ protected function get_download_url($file_name, $version = null) {
181187

182188
protected function set_file_delete_properties($file) {
183189
$file->delete_url = $this->options['script_url']
184-
.'?file='.rawurlencode($file->name);
190+
.$this->get_query_separator($this->options['script_url'])
191+
.'file='.rawurlencode($file->name);
185192
$file->delete_type = $this->options['delete_type'];
186193
if ($file->delete_type !== 'DELETE') {
187194
$file->delete_url .= '&_method=DELETE';

0 commit comments

Comments
 (0)