mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 03:14:52 +00:00
Import CSV - Check file uploaded
Check the file was uploaded when importing a CSV. Can probably convert this into a function at a later date.
This commit is contained in:
@@ -473,8 +473,18 @@ if (isset($_POST["import_client_assets_csv"])) {
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$file_name = $_FILES["file"]["tmp_name"];
|
||||
|
||||
$error = false;
|
||||
|
||||
if (!empty($_FILES["file"]["tmp_name"])) {
|
||||
$file_name = $_FILES["file"]["tmp_name"];
|
||||
} else {
|
||||
$_SESSION['alert_message'] = "Please select a file to upload.";
|
||||
$_SESSION['alert_type'] = "error";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
exit();
|
||||
}
|
||||
|
||||
//Check file is CSV
|
||||
$file_extension = strtolower(end(explode('.',$_FILES['file']['name'])));
|
||||
$allowed_file_extensions = array('csv');
|
||||
|
||||
Reference in New Issue
Block a user