我正在使用 PHP 创建一个服务来接受文件,然后将信息输入 MySQL 数据库。我没有产生任何错误(至少不在error_log目录中)。文件上传正常,但是信息没有输入数据库,正如我所说,我没有看到列出的错误,很可能有,我不确定在哪里看。
include("connect.php");
$type = "jpg";
foreach ($_GET as $key => $value) { eval("\$" . $key . " = \"" . $value . "\";");}  
$filename = isset($_REQUEST["filename"]) ? $_REQUEST["filename"] : "jjj";  
$append = $_REQUEST["append"];
if($code == "XXX")  
{  
    try  
        {       
            mysql_query("INSERT INTO `images-table` (`file-name`, `file-type`) VALUES (`". $filename . "`, `" . $type . "`)");
            if(!$append)  
                $file = fopen("uploads/" . $filename,"w");  
            else  
                $file = fopen("uploads/" . $filename,"a");  
            $input = file_get_contents ("php://input");  
            fwrite($file,$input);  
            fclose($file);  
    echo "OK";
        }  
    catch (Exception $e)   
        {  
            echo 'Caught exception: ',  $e->getMessage(), "\n";  
        }  
}
else
{
echo 'You do not have permission to do this.';
}