0
插入目錄文件夾中的圖像不在數據庫中?請查看代碼,可以在文件夾中查看圖像,但不能在數據庫中查看圖像,而是在命令中插入pc.gif,否則文件名將在命令上執行,但執行其他命令?第一個命令是正確的,爲什麼第二個命令被執行。插入目錄文件夾中的圖像不在數據庫中?
if($action=="insertproject"){
if ($_FILES['logo']['name'] != "") {
$imageInfo = getimagesize($_FILES['logo']['tmp_name']); // get image size
$width = $imageInfo[0]; // image width
$height = $imageInfo[1]; // image height
if($height > 2000 || $width > 2000){
echo "<script> alert('Image is to big! Try to resize the picture!') </script>";
exit;
} // check size
$newimg1 = date("YmdHis").".jpg"; // set name for new image
$newimg2 = date("YmdHis").".pdf"; // set name for pdf if is necesary
if(stristr($_SERVER['OS'],"win")){
$path = "prodimg/";
} // determin path of image folder
elseif(stristr($_SERVER['OS'],"linux")){
$path = str_replace("admin.php","",$_SERVER['SCRIPT_FILENAME']) . "prodimg/";
}
else {
$path = "prodimg/";
}
move_uploaded_file ($_FILES['logo']['tmp_name'], $path . $newimg1 );
} // copy image in image folder
else{
$newimg1="pc.gif";
} // if is not posible than set image name as pc.gif
$serviceid = $_POST['serviceid'];
$projectcode = $_POST['projectcode'];
$projecttitle = $_POST['projecttitle'];
$update = $_POST['update'];
$projectstatus = $_POST['projectstatus'];
$progress = "on progress";
$sector = $_POST['sector'];
$dateofrtecreview = $_POST['dateofrtecreview'];
$dateapprovedatrpmolevel = $_POST['dateapprovedatrpmolevel'];
$dateendorsedtonpmo = $_POST['dateendorsedtonpmo'];
$dateapprovednpmo = $_POST['dateapprovednpmo'];
$datereceivedbyrpmo = $_POST['datereceivedbyrpmo'];
$expectedoutput = $_POST['expectedoutput'];
$yearassistancereceived = $_POST['yearassistancereceived'];
$setupinvestment = $_POST['setupinvestment'];
$beneficiaryinvestment = $_POST['beneficiaryinvestment'];
$projectdescription = $_POST['projectdescription'];
$res = mysql_query("insert into appointment_detail(`serviceid`,`picture`,`projectdescription`,`dateofrtecreview`,`dateapprovedatrpmol evel`,`dateendorsedtonpmo`,`dateapprovednpmo`,`datereceivedbyrpmo`,`expectedoutput`,`projectcode`,`projecttitle`,`update`,`status`,`projectstatus`,`sector`,`setupinvestment`,`beneficiaryinvestment`)
values('$serviceid','$newimg1','$projectdescription','$dateofrtecreview','$dateapprovedatrpmolevel',' $dateendorsedtonpmo','$dateapprovednpmo','$datereceivedbyrpmo','$expectedoutput','$projectcode','$pro jecttitle','$update','$progress','$projectstatus','$sector','$setupinvestment','$beneficiaryinvestmen t')");
echo "<script>location.replace('admin.php?action=showallprojects')</script>";
}
展望這裏有明顯的答案......'$ _FILES ['logo'] ['name'] ==「」' – Bryan 2014-10-01 02:49:29
''$ beneficiary投資')「)'你在那裏有空間應該是''$ beneficiaryinvestment')」) – 2014-10-01 02:49:48
@Bryan你是什麼意思? – 2014-10-01 02:55:54