i just need to grant access only to upload .csv and .xlsx files to my uploading folder. so what modifications should i do in the following coding.
<?php if (isset($_POST["submit"])) {
if (isset($_FILES["file"])) {
// $_SESSION['date_ss'] = $_POST['date_ss'];
//if there was an error uploading the file
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
} else {
if (file_exists($_FILES["file"]["name"])) {
unlink($_FILES["file"]["name"]);
}
$target_path = "uploads/";
$target_location = $target_path . basename($_FILES['file']['name']);
$_SESSION['target_location'] = $target_location;
// $datess = $_POST['date_ss'];
move_uploaded_file($_FILES["file"]["tmp_name"], $target_location);
$uploadedStatus = 1;
}
} else {
echo "No file selected <br />";
}
}
?>