diff --git a/html/upload.php b/html/upload.php
index 5e2a6463..51a44ad6 100644
--- a/html/upload.php
+++ b/html/upload.php
@@ -11,6 +11,9 @@ if(isset($_POST['titre'])) {
$filename = rand(100000, 999999);
$destination = "../content/journal/" . $filename . ".md";
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
+ if (!move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
+ die("Le fichier n'a pas pu être téléchargé.");
+ }
$upload = $bdd->prepare("INSERT INTO articles (ID, titre, date, auteur) VALUES (:filename, :titre, :date, :auteur)");
$upload->bindParam(':filename', $filename);
$upload->bindParam(':titre', htmlspecialchars($_POST['titre']));
@@ -23,10 +26,8 @@ if(isset($_POST['titre'])) {
if($upload->execute()) {
$status = "Uploaded";
} else {
- $status = "Error";
+ $status = "SQL Error";
}
-
- move_uploaded_file($_FILES['file']['tmp_name'], $destination);
}
?>