0

就是这样,我还必须建立它会将图片上传到服务器,但它出现的错误导致无法继续或该说什么?唔

activate.php

<input type="file" name="file" />

activate_updater.php

<?php include ("include/database/db.php");
ini_set('display_errors',1);
error_reporting(E_ALL | E_STRICT);
session_start();

        $pb = null;
        include("class.upload.php");
        $handle = new Upload($_FILES['profilbillede']);

        if($handle->uploaded){
                //lidt mere store billeder
                $handle->image_resize = true;
                $handle->image_ratio_y = true;
                $handle->image_x = 220;
                $handle->Process("profil/store");
                    //til profil billede lign..
                    $handle->image_resize = true;
                    $handle->image_ratio_crop = true;
                    $handle->image_y = 75;
                    $handle->image_x = 75;
                    $handle->Process("profil");                
            $pb = $handle->file_dst_name;

                echo 'Billedet: '.$pb.'<br>';
                echo "Dit billede blev upload<br>";
        }else{
                $pb = 'bruger_intet.png';
            }

    if($stmt = $mysqli->prepare('UPDATE `brugere` SET `rank`=2, `katogori`=?, `djnavn`=?, `profilbillede`=?, `profiltekst`=?, `facebook`=?, `pris`=?, `booking`=?, `mobil`=? WHERE `code`=?'))
    {

        $stmt->bind_param('iiiiiiiis', $katogori, $djnavn, $profilbillede, $profiltekst, $facebook, $pris, $booking, $mobil, $g_code);
        //fra input ting ting..
        $katogori = $_POST["kategori"];
        $djnavn = $_POST["djnavn"];
        $profilbillede = $_POST["file"];
        $profiltekst = $_POST["profiltekst"];
        $facebook = $_POST["facebook"];
        $pris = $_POST["pris"];
        $booking = $_POST["booking"];
        $mobil = $_POST["mobil"];
        $g_code = $_SESSION["code"];

        $stmt->execute();
        $stmt->close();

        header("Location: http://.....dk/logind/");

    }
    else
    {
        echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
    }
?>

所以这里出现了错误?

注意:未定义的索引:第 37 行 /home/jesperbo/public_html/,,,.dk/activate_updater.php 中的文件

警告:无法修改标头信息 - 标头已由 /home/jesperbo/public_html/,,.dk/activate_updater.php 中的(输出开始于 /home/jesperbo/public_html/,,,.dk/activate_updater.php:24)发送在第 48 行

问题来了

$profilbillede = $_POST["file"];

和这里

echo 'Billedet: '.$pb.'<br>';

和这里

header("Location: http://....dk/logind/");
4

2 回答 2

0

就像错误消息说的那样,输出文本后不能发送标题。

header('....')

必须出现任何 echo 命令之前。

于 2012-05-21T23:16:08.857 回答
0

标头已发送后,您无法发送标头。修改您的代码,使标题位于任何输出之前,包括空格

于 2012-05-21T23:17:00.217 回答