34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
|
<?php
|
||
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||
|
$target_dir = $root."/storage/records";
|
||
|
echo $target_dir;
|
||
|
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
|
||
|
$uploadOk = 1;
|
||
|
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||
|
$MAXIMUM_FILESIZE = 10000 * 1024 * 1024;
|
||
|
// Check if image file is a actual image or fake image
|
||
|
if(isset($_POST["submit"])) {
|
||
|
if (is_uploaded_file($_FILES['fileToUpload']['tmp_name'])) {
|
||
|
$safe_filename = preg_replace(
|
||
|
array("/\s+/", "/[^-\.\w]+/"),
|
||
|
array("_", ""),
|
||
|
trim($_FILES['fileToUpload']['name']));
|
||
|
if ($_FILES['fileToUpload']['size'] <= $MAXIMUM_FILESIZE)
|
||
|
{
|
||
|
$isMove = move_uploaded_file (
|
||
|
_FILES['fileToUpload']['tmp_name'],
|
||
|
$dir_base.$safe_filename);
|
||
|
|
||
|
if ($isMove) {
|
||
|
echo "File moved";
|
||
|
} else {
|
||
|
echo "File not moved";
|
||
|
}
|
||
|
} else {
|
||
|
echo "Maximum file size exceeded";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|