【发布时间】:2015-09-28 22:18:12
【问题描述】:
嗨,最近我安装了 linux 并安装了 lamp + phpmyadmin,这个脚本在我使用 win 时在 xampp 上运行良好,但现在它不会执行,我已经更改了 dbconnect.php 文件中的信息,并且如果我手动插入行,它会正常显示。那么谁能告诉我问题出在哪里...?
php有问题的脚本:
<?php
include ("dbc.php");
session_start();
function GetImageExtension($imagetype)
{
if(empty($imagetype)) return false;
switch($imagetype)
{
case 'image/bmp': return '.bmp';
case 'image/gif': return '.gif';
case 'image/jpeg': return '.jpg';
case 'image/png': return '.png';
default: return false;
}
}
if (!empty($_FILES["uploadedimage"]["name"])) {
$file_name=$_FILES["uploadedimage"]["name"];
$temp_name=$_FILES["uploadedimage"]["tmp_name"];
$imgtype=$_FILES["uploadedimage"]["type"];
$ime=$_FILES["ime"];
$link=$_FILES["link"];
$ext= GetImageExtension($imgtype);
$imagename=date("d-m-Y")."-".time().$ext;
$target_path = "images/".$imagename;
$postavio=$_SESSION['user_name'];
if(move_uploaded_file($temp_name, $target_path)) {
$query_upload="INSERT into linkovi ( ime , link , postavio , slika , datum ) VALUES ('".$_POST["ime"]."','".$_POST["link"]."','".$postavio."','".$target_path."','".date("Y-m-d")."')";
mysql_query($query_upload) or die("error in $query_upload == ----> ".mysql_error());
header("Location:dodaj-film.php?uploaded=1");
}else{
exit("Error While uploading image on the server");
header("Location:dodaj-film.php?uploaded=0");
}
}
?>
【问题讨论】:
-
如果您让我们知道您遇到了什么具体错误,我们会更容易帮助您
-
我刚刚得到这个文本:在服务器上上传图片时出错