我有一個表格來上傳文件,代碼檢查它是否到達這裏:
if (is_uploaded_file($_FILES['foto'] ['tmp_name'])){
echo "file is valid and was uploaded";
print_r($_FILES);
}
和它說:
file is valid and was uploadedArray ([foto] =>
Array ([name] => Penguins.jpg [type] => image/jpeg [tmp_name]
=> /var/www/uploads/phpf8ECTX [error] => 0 [size] => 777835))
Array ([foto] => Array ([name] => Penguins.jpg [type] => image/jpeg [tmp_name]
=> /var/www/uploads/phpf8ECTX [error] => 0 [size] => 777835)) array(1) {
["foto"]=> array(5) { ["name"]=> string(12) "Penguins.jpg" ["type"]=> string
(10) "image/jpeg" ["tmp_name"]=> string(26) "/var/www/uploads/phpf8ECTX" ["error"]
=> int(0) ["size"]=> int(777835) } }
但文件沒有到達,php.ini配置正確,並且/ var/www/uploads目錄有權限爲所有用戶編寫,我在linux中運行apache2,有關錯誤的任何想法? 謝謝
爲'is_uploaded_file支票()'是多餘的 - 它包含在'move_uploaded_file()以'。 –