0
我只需要授予訪問權限,即只能將.csv和.xlsx文件上傳到我的上傳文件夾。所以我應該在下面的編碼中做些什麼修改。如何將excel和csv文件上傳到上傳文件夾
<?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 />";
}
}
?>
非常感謝你 –