嗨,我的上传表单页面在上传后没有重定向到thank-you.php 页面。一切都很完美我不想更改代码,只是标题没有指示页面转到thank-you.php。
这是发布数据的代码。
<?php
$target = "Carpics";
//$target = $target . basename( $_FILES['photo']['name']);
ini_set('display_errors',1);
error_reporting(0);
$conn = mysql_connect("localhost","admin","");
if(!$conn)
{
echo mysql_error();
}
$db = mysql_select_db("upload",$conn);
if($db)
{ echo mysql_error();
}
$name = $_POST['name'];
$address = $_POST['address'];
$from_date = $_POST['from_date'];
$to_date = $_POST['to_date'];
$full_name = $_POST['full_name'];
$email = $_POST['email'];
$city = $_POST['city'];
$tel = $_POST['tel'];
$town = $_POST['town'];
$country = $_POST['country'];
$model = $_POST['model'];
$displacement = $_POST['displacement'];
$trans = $_POST['trans'];
$driver = $_POST['driver'];
$photopath1 = $target . basename( $_FILES['photo1']['name']);
$photopath2 = $target . basename( $_FILES['photo2']['name']);
$photopath3 = $target . basename( $_FILES['photo3']['name']);
$photopath4 = $target . basename( $_FILES['photo4']['name']);
for($i=1;$i<5;$i++){
if($i==1){
$target = $photopath1;
}elseif($i==2){
$target = $photopath2;
}elseif($i==3){
$target = $photopath3;
}elseif($i==4){
$target = $photopath4;
}
$photo = addslashes(file_get_contents($_FILES['photo'.$i]['tmp_name']));
$image = getimagesize($_FILES['photo'.$i]['tmp_name']);
$imgtype = $image['mime'];
if(move_uploaded_file($_FILES['photo'.$i]['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['photo'.$i]['name']);
}
else {
echo "Sorry, there was a problem uploading your file.";
}
}
if(!$insert = mysql_query("INSERT INTO data VALUES('','$name','$address','$from_date','$to_date','$full_name','$email','$city','$tel','$town','$country','$model','$displacement','$trans','$driver','$photo', '$photopath1', '$photopath2', '$photopath3', '$photopath4','$imgtype')"));
echo header('Location: thank-you.php');
?>
而是显示这个 文件 img5.jpg 文件 img7.jpg 文件 Pontiac sports car.jpg 文件 volkswagen-polo.jpg
请帮忙