This commit is contained in:
2020-02-20 21:50:53 -05:00
parent 8443a78378
commit 1fdf24fdac
+14 -2
View File
@@ -233,9 +233,21 @@ class Member extends Member_Controller {
$fileNameCmps = explode(".", $fileName); $fileNameCmps = explode(".", $fileName);
$fileExtension = strtolower(end($fileNameCmps)); $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); print_r($_FILES);
} }
} }
} }