Php 没有使用move_uploaded_file()的文件或目录

Php 没有使用move_uploaded_file()的文件或目录,php,mysql,sql,database,phpmyadmin,Php,Mysql,Sql,Database,Phpmyadmin,我正在编写我的PHP代码(insert_post.PHP),我有两个错误: **警告:移动上传的文件(news\u images/RaiderX.jpg):无法打开流:第106行的C:\xampp\htdocs\my\u cms\admin\insert\u post.php中没有此类文件或目录 警告:move_upload_file():无法将C:\xampp\tmp\php60F7.tmp移动到C:\xampp\htdocs\my_cms\admin\insert_post.php第106行

我正在编写我的PHP代码(insert_post.PHP),我有两个错误:

**警告:移动上传的文件(news\u images/RaiderX.jpg):无法打开流:第106行的C:\xampp\htdocs\my\u cms\admin\insert\u post.php中没有此类文件或目录

警告:move_upload_file():无法将C:\xampp\tmp\php60F7.tmp移动到C:\xampp\htdocs\my_cms\admin\insert_post.php第106行的“news_images/RaiderX.jpg”**

一切都很好,我可以看到数据(图像)正在进入我的mysql数据库,但我无法理解为什么会出现这两个错误

代码如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>

<style type="text/css">
td, td {
        padding:0px;
        margin:0px;
        }

</style>
<script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
<script>tinymce.init({selector:'textarea'});</script>

</head>

<body>

<form action="insert_post.php" method="post" enctype="multipart/form-data">

        <table width="800" align="center" border="2">
        <tr bgcolor="#F47302">
                <td colspan="6" align="center"><h1>Insert New Post</h1></td>
        </tr>

        <tr>
                <td align="right" bgcolor="F47302"><strong>Post Title:</strong></td>
            <td><input type="text" name="post_title" size="40"</td>
        </tr>

         <tr>
                <td align="right"bgcolor="F47302" ><strong>Post Categories:</strong></td>
            <td>
                <select name="cat">
                        <option value="null">Select a Category</option>
           <?php
                        include("../includes/database.php");

                        $get_cats = "select * from categories";

                        $run_cats = mysqli_query($con, $get_cats);

                        while ($cats_row=mysqli_fetch_array($run_cats)) {

                                $cat_id=$cats_row['cat_id'];
                                $cat_title=$cats_row['cat_title'];

                                echo "<option value='$cat_id'>$cat_title</option>";
                                }
                        ?>
                </select>

            </td>
        </tr>

         <tr>
                <td align="right" bgcolor="F47302"><strong>Post Author:</strong></td>
            <td><input type="text" name="post_author" size="40"</td>
        </tr>
         <tr>
                <td align="right" bgcolor="F47302"><strong>Post Keywords:</strong></td>
            <td><input type="text" name="post_keywords" size="50"</td>
        </tr>

         <tr>
                <td align="right" bgcolor="F47302"><strong>Post Image:</strong></td>
            <td><input type="file" name="post_image" size="50"</td>
        </tr>
         <tr>
                <td align="right" bgcolor="F47302"><strong>Post Content:</strong></td>
            <td><textarea name="post_content" rows="15" cols="60"></textarea></td>
        </tr>
         <tr>
            <td colspan="6" align="center" bgcolor="F47302"><input type="submit" name="submit" value="Publish Now"</td>
        </tr>

    </table>
</form>
</body>
</html>

<?php
if(isset($_POST['submit'])) {

   $post_title = $_POST['post_title'];
   $post_date = date('m-d-y');
   $post_cat = $_POST['cat'];
   $post_author = $_POST['post_author'];
   $post_keywords = $_POST['post_keywords'];
   $post_image = $_FILES['post_image'] ['name'];
   $post_image_tmp = $_FILES['post_image']['tmp_name'];
   $post_content = $_POST['post_content'];



        if($post_title=='' OR $post_cat=='null' OR $post_author=='' OR $post_keywords=='' OR $post_image=='' OR $post_content==''){

                echo "<script>alert('Please fill in all the fileds')</script>";
                exit();
                }
        else {

                move_uploaded_file($post_image_tmp,"news_images/$post_image");

                $insert_posts = "insert into posts (category_id,post_title,post_date,post_author,post_keywords,post_image,post_content) values ('$post_cat','$post_title','$post_date','$post_author','$post_keywords','$post_image','$post_content')";

                $run_posts = mysqli_query($con,$insert_posts);

                        echo "<script>alert('Post Has been Published!')</script>";

                        echo "<script>window.open('index.php?insert_post','_self')</script>";
                }
        }

?>

无标题文件
td,td{
填充:0px;
边际:0px;
}
init({选择器:'textarea'});
插入新员额
帖子标题:
检查


对于任何类型的上传错误,首先,这可能会让您更好地了解发生这种情况的原因,并发现问题所在,因此您不会在数据库中缓存丢失文件的信息

您确定
news\u images/RaiderX.jpg
存在并且具有正确的权限吗?您容易受到攻击。是@MarcB我知道(稍后我将针对SQLi和XSS保护代码)。
$_FILES["post_image"]["error"]