1

I've a html upload form. It's working in my Localhost. But It's not working on live sever. It's insert the information to db but not uploading the file to folder called "photos".

Php code:

$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(); 
        }

Debug:

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

Why it's not uploading to "photos" folder ? On server how it's show C:\Windows ?

4

2 に答える 2

1

問題は最大ファイルサイズにあると思います

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

php.iniで値をより高い値に変更します。安全な方法は、最大アップロードサイズを2MBに制限することです。

于 2013-02-25T06:26:31.160 に答える
0

サイズとタイプを検証します。その後、それを確認してください。

于 2013-02-25T07:19:52.727 に答える