1

我有一个 html 上传表单。它在我的本地主机中工作。但它不适用于实时服务器。它将信息插入数据库,但不将文件上传到名为“photos”的文件夹。

php代码:

$upload_path = "photos/";
$upload = mysql_query("INSERT INTO photos (photo_cap, photo_name, photo, date) 
VALUES('$title','$filenameuniq', '$file', '$uploadate')");

        if($upload)
        {                       
            if(!empty($file))
            {
                if(!move_uploaded_file($_FILES['file']['tmp_name'], $upload_path . $filenameuniq))
                {
                echo '<pre>Your file was not uploaded please try again here are your debug informations:'.print_r($_FILES) .'</pre>';                   
                }                   
            }//// upload to folder  

            echo "<font color=green>Successfully Updated.</font>";
            header("Refresh:2; url=allphotos.php");
            exit(); 
        }

调试:

Array ( [file] => Array ( [name] => Blue hills.jpg [type] => image/jpeg [tmp_name] => 
C:\Windows\Temp\php95FB.tmp [error] => 0 [size] => 28521 ) )

Your file was not uploaded please try again here are your debug informations:1

为什么它不上传到“照片”文件夹?在服务器上如何显示 C:\Windows ?

4

2 回答 2

1

我认为问题在于最大文件大小

Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

在 php.ini.safer 中将值更改为更高的值是将最大上传大小限制为 2mb

于 2013-02-25T06:26:31.160 回答
0

验证大小和类型。然后检查它..

于 2013-02-25T07:19:52.727 回答