This commit is contained in:
2020-02-20 21:50:53 -05:00
parent 8443a78378
commit 1fdf24fdac
+15 -3
View File
@@ -232,10 +232,22 @@ class Member extends Member_Controller {
$fileType = $_FILES['uploadedFile']['type'];
$fileNameCmps = explode(".", $fileName);
$fileExtension = strtolower(end($fileNameCmps));
$newFileName = md5(time() . $fileName) . '.' . $fileExtension;
$allowedfileExtensions = array('jpg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc', 'mp4');
if (in_array($fileExtension, $allowedfileExtensions)) {
// directory in which the uploaded file will be moved
$uploadFileDir = '/home/uploads/';
$dest_path = $uploadFileDir . $newFileName;
if (move_uploaded_file($fileTmpPath, $dest_path)) {
$message = 'File is successfully uploaded.';
} else {
$message = 'There was some error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
}
}
print_r($_FILES);
}
}
}