mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Issue #4100 Possible Fix for filename cleaning issue.
This commit is contained in:
@@ -2048,14 +2048,14 @@ class e_media
|
|||||||
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
|
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
|
||||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
|
|
||||||
// Clean the fileName for security reasons
|
|
||||||
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
|
|
||||||
|
|
||||||
if(!empty($_FILES['file']['name']) && $_FILES['file']['name'] !== 'blob' ) // dropzone support v2.1.9
|
if(!empty($_FILES['file']['name']) && $_FILES['file']['name'] !== 'blob' ) // dropzone support v2.1.9
|
||||||
{
|
{
|
||||||
$fileName = $_FILES['file']['name'];
|
$fileName = $_FILES['file']['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean the fileName for security reasons
|
||||||
|
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
|
||||||
|
|
||||||
// $array = array("jsonrpc" => "2.0", "error" => array('code'=>$_FILES['file']['error'], 'message'=>'Failed to move file'), "id" => "id", 'data'=>$_FILES );
|
// $array = array("jsonrpc" => "2.0", "error" => array('code'=>$_FILES['file']['error'], 'message'=>'Failed to move file'), "id" => "id", 'data'=>$_FILES );
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user