0

ページ/サーバーに写真をアップロードする必要があるのですが、サイトにアップロードする必要があるたびに、何をしても「ここでエラー」と表示されます。写真をアップロードせず、古いプロフィール写真を削除しません

<?php
        if(isset($_POST["uploadIMGIndhold"]))
        {
        ?>
        <div style="background:red; padding:5px 3px; color:#fff;" id="top_boxxen_indhold_bruger">
        <?php
            if($_POST["file"] != "")
            {
                if ($stmt = $this->mysqli->prepare('SELECT `img` FROM `bruger` WHERE `id` = ?')) { 
            $stmt->bind_param('i', $id);
            $id = $_SESSION["id"];
            $stmt->execute();
            $stmt->bind_result($img);

            while ($stmt->fetch()) {
                unlink("indhold/profil/" . $img . "");
                unlink("indhold/profil/index/" . $img . "");
            }
            $stmt->close();
        } else {
            echo 'Der opstod en fejl i erklæringen: ' . $this->mysqli->error;
        }


        $pb = null;

        include "indhold/inc/billede/class.upload.php";
        $handle = new Upload($_FILES["file"]);

        if($handle->uploaded)
        {
            $handle->image_resize = true;
            $handle->image_ratio_crop = true;
            $handle->image_y = 75;
            $handle->image_x = 75;
            $handle->Process("indhold/profil");

            $handle->image_resize = true;
            $handle->image_ratio_y = true;
            $handle->image_x = 320;
            $handle->Process("indhold/profil/index");

            $pb = $handle->file_dst_name;
        }

        if ($stmt = $this->mysqli->prepare('UPDATE `bruger` SET `img`=? WHERE `id`=?')) { 
            $stmt->bind_param('ss', $img, $id);
            $img = $pb; 
            $id = $_SESSION["id"];
            $stmt->execute();
                echo "Godkendt";
            $stmt->close();

        } else {
            /* Der er opstÃÂ¥et en fejl */
            echo 'Der opstod en fejl i erklæringen: ' . $this->mysqli->error;
        }   
            }
            else
            {
                echo "<p class=\"luk_ned_igen\">Error here</p>";
            }
        ?>
        </div>
        <?php
        }
    ?>

        <h5>Upload Profilbillede</h5>
        <form action="#" enctype="multipart/form-data" method="post">
            <table>
                <tr>
                    <td>Profilbillede</td>
                    <td><input type="file" name="file"></td>
                </tr>
                <tr>
                    <td><input type="submit" name="uploadIMGIndhold" value="Upload billedet" class="new upload_boxxen"></td>
                    <td></td>
                </tr>
            </table>
        </form>

問題は次のとおりです。エラーが表示されるだけで、他には何も表示されません。古い問題の写真をわざわざアップロードして削除しないのはどうしてでしょうか。

エラーがまったく表示されません!

4

0 に答える 0