modified : arbitrary files upload issue fixed
This commit is contained in:
parent
728044872b
commit
4038063c37
3 changed files with 31 additions and 0 deletions
|
@ -147,6 +147,15 @@ switch($mode)
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$extension = getExt( $_FILES['file']['name']);
|
||||||
|
$types = strtolower(config('allowed_types'));
|
||||||
|
$supported_extensions = explode(',', $types);
|
||||||
|
|
||||||
|
if (!in_array($extension, $supported_extensions)) {
|
||||||
|
echo json_encode(array("status"=>"504","msg"=>"Invalid extension"));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$targetDir = CB_BEATS_UPLOAD_DIR;
|
$targetDir = CB_BEATS_UPLOAD_DIR;
|
||||||
# $directory = create_dated_folder( CB_BEATS_UPLOAD_DIR );
|
# $directory = create_dated_folder( CB_BEATS_UPLOAD_DIR );
|
||||||
# $targetDir .= '/'.$directory;
|
# $targetDir .= '/'.$directory;
|
||||||
|
|
|
@ -193,7 +193,14 @@ switch($mode)
|
||||||
echo json_encode(array("status"=>"400","err"=>"Invalid Content"));
|
echo json_encode(array("status"=>"400","err"=>"Invalid Content"));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
$extension = getExt( $_FILES['file']['name']);
|
||||||
|
$types = strtolower(config('allowed_types'));
|
||||||
|
$supported_extensions = explode(',', $types);
|
||||||
|
|
||||||
|
if (!in_array($extension, $supported_extensions)) {
|
||||||
|
echo json_encode(array("status"=>"504","msg"=>"Invalid extension"));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
//pr($_REQUEST);
|
//pr($_REQUEST);
|
||||||
$targetDir = PHOTOS_DIR;
|
$targetDir = PHOTOS_DIR;
|
||||||
$directory = create_dated_folder( PHOTOS_DIR );
|
$directory = create_dated_folder( PHOTOS_DIR );
|
||||||
|
|
|
@ -36,6 +36,21 @@ if(isset($_POST['update_avatar_bg']))
|
||||||
if(isset($_FILES["coverPhoto"])){
|
if(isset($_FILES["coverPhoto"])){
|
||||||
if(isset($_FILES["coverPhoto"]) && get_mime_type($_FILES["coverPhoto"]['tmp_name']) == 'image'){
|
if(isset($_FILES["coverPhoto"]) && get_mime_type($_FILES["coverPhoto"]['tmp_name']) == 'image'){
|
||||||
$array = $_FILES;
|
$array = $_FILES;
|
||||||
|
|
||||||
|
$extension = getExt( $_FILES['coverPhoto']['name']);
|
||||||
|
$types = strtolower(config('allowed_types'));
|
||||||
|
$supported_extensions = explode(',', $types);
|
||||||
|
|
||||||
|
if (!in_array($extension, $supported_extensions)) {
|
||||||
|
$response = array(
|
||||||
|
"status" => false,
|
||||||
|
"msg" => "Invalid extension provided",
|
||||||
|
"url" => false,
|
||||||
|
);
|
||||||
|
echo json_encode($response);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
$array['userid'] = userid();
|
$array['userid'] = userid();
|
||||||
$coverUpload = $userquery->updateCover($array);
|
$coverUpload = $userquery->updateCover($array);
|
||||||
$timeStamp = time();
|
$timeStamp = time();
|
||||||
|
|
Loading…
Add table
Reference in a new issue