Skip to content

Commit 3b487a5

Browse files
committed
Security: BigUpload: Remove unused method to upload file
1 parent 385a755 commit 3b487a5

File tree

1 file changed

+0
-65
lines changed

1 file changed

+0
-65
lines changed

main/inc/lib/javascript/bigupload/inc/bigUpload.php

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@
55

66
class BigUploadResponse
77
{
8-
/**
9-
* Temporary directory for uploading files.
10-
*/
11-
const TEMP_DIRECTORY = '/tmp/';
12-
13-
/**
14-
* Directory files will be moved to after the upload is completed.
15-
*/
16-
const MAIN_DIRECTORY = '../files/';
17-
188
/**
199
* Max allowed filesize. This is for unsupported browsers and
2010
* as an additional security check in case someone bypasses the js filesize check.
@@ -28,13 +18,6 @@ class BigUploadResponse
2818
*/
2919
private $tempDirectory;
3020

31-
/**
32-
* Directory for completed uploads.
33-
*
34-
* @var string
35-
*/
36-
private $mainDirectory;
37-
3821
/**
3922
* Name of the temporary file. Used as a reference to make sure chunks get written to the right file.
4023
*
@@ -49,7 +32,6 @@ public function __construct()
4932
{
5033
$tempDirectory = api_get_path(SYS_ARCHIVE_PATH);
5134
$this->setTempDirectory($tempDirectory);
52-
$this->setMainDirectory(self::MAIN_DIRECTORY);
5335
$this->maxSize = getIniMaxFileSizeInBytes();
5436
}
5537

@@ -105,26 +87,6 @@ public function getTempDirectory()
10587
return $this->tempDirectory;
10688
}
10789

108-
/**
109-
* Set the name of the main directory.
110-
*
111-
* @param string $value Main directory
112-
*/
113-
public function setMainDirectory($value)
114-
{
115-
$this->mainDirectory = $value;
116-
}
117-
118-
/**
119-
* Return the name of the main directory.
120-
*
121-
* @return string Main directory
122-
*/
123-
public function getMainDirectory()
124-
{
125-
return $this->mainDirectory;
126-
}
127-
12890
/**
12991
* Function to upload the individual file chunks.
13092
*
@@ -288,30 +250,6 @@ public function finishUpload()
288250

289251
return json_encode(['errorStatus' => 0]);
290252
}
291-
292-
/**
293-
* Basic php file upload function, used for unsupported browsers.
294-
* The output on success/failure is very basic, and it would be best to have these errors return the user to index.html
295-
* with the errors printed on the form, but that is beyond the scope of this project as it is very application specific.
296-
*
297-
* @return string Success or failure of upload
298-
*/
299-
public function postUnsupported()
300-
{
301-
$name = $_FILES['bigUploadFile']['name'];
302-
$size = $_FILES['bigUploadFile']['size'];
303-
$tempName = $_FILES['bigUploadFile']['tmp_name'];
304-
305-
if (filesize($tempName) > $this->maxSize) {
306-
return get_lang('UplFileTooBig');
307-
}
308-
309-
if (move_uploaded_file($tempName, $this->getMainDirectory().$name)) {
310-
return get_lang('FileUploadSucces');
311-
} else {
312-
return get_lang('UplUnableToSaveFile');
313-
}
314-
}
315253
}
316254

317255
$sessionBigUpload = ChamiloSession::read('bigupload', []);
@@ -358,7 +296,4 @@ public function postUnsupported()
358296
ChamiloSession::write('bigupload', $sessionBigUpload);
359297
}
360298
break;
361-
case 'post-unsupported':
362-
print $bigUpload->postUnsupported();
363-
break;
364299
}

0 commit comments

Comments
 (0)