用mysql上传文件不起作用

我写了一个简单的上传系统,但是上传系统不起作用。我希望你能帮帮我!

我的php代码:

if (isset($_POST['taskAdd'])) {
    move_uploaded_file($_FILES['taskFile1']['tmp_name'], '../files/' . $_FILES['taskFile1']['name']);
    $stmt = $con->prepare("INSERT INTO tasks (taskFile1) VALUES (:taskFile1)");
    $stmt->execute();
            header("Location: /index/");
}

错误消息:

Warning: move_uploaded_file(../files/login.html): failed to open stream: No such file or directory in C:\xampp\htdocs\functions\taskAdd.php on line 13

Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\phpA9F3.tmp' to '../files/login.html' in C:\xampp\htdocs\functions\taskAdd.php on line 13

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':taskFile1)' at line 1 in C:\xampp\htdocs\functions\taskAdd.php:15 Stack trace: #0 C:\xampp\htdocs\functions\taskAdd.php(15): PDOStatement->execute() #1 C:\xampp\htdocs\tasks\add\index.php(7): include('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\functions\taskAdd.php on line 4
评论