php代码返回成功,但未在文件夹中写入任何内容
在我的本地主机上,一切正常,我将文件放在服务器上,将特权设置为777,
root@phpmyadmin-sdp:/var/www/html/SaveImages# cd images
root@phpmyadmin-sdp:/var/www/html/SaveImages/images# sudo chgrp -R www-data /var/www
root@phpmyadmin-sdp:/var/www/html/SaveImages/images# sudo chmod -R g+w /var/www
这是文件夹的渗透性:
drwxrwxr-x 2 www-data www-data 4096 Jul 23 08:43 images
-rw-r--r-- 1 root root 17 Jul 23 09:17 phpinfo.php
-rw-rw-r-- 1 www-data www-data 529 Jul 23 08:43 uploadImages.php
没有任何作用
php代码:
<?php
if(isset($_FILES['theFile']))
{
//print("Success! ");
//print("tmpName: " . $_FILES['theFile']['tmp_name'] . " ");
// print("size: " . $_FILES['theFile']['size'] . " ");
// print("mime: " . $_FILES['theFile']['type'] . " ");
// print("name: " . $_FILES['theFile']['name'] . " ");
print("images/". $_FILES['theFile']['name']);
move_uploaded_file($_FILES['theFile']['tmp_name'], "images/" . $_FILES['theFile']['name']);
} else
{
print("Failed!");
}
?>
我使用了以下代码:
$log = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
"Attempt: ".($result[0]['success']=='1'?'Success':'Failed').PHP_EOL.
"User: ".$username.PHP_EOL.
"-------------------------".PHP_EOL;
//-
file_put_contents('./log_'.date("j.n.Y").'.txt', $log, FILE_APPEND);
写日志,但我只有这个:
User: 94.38.32.18 - July 23, 2019, 10:59 am
Attempt: Failed
User:
-------------------------
在文件方面,它是像在localhost上那样编写的。
请帮助
编辑,服务器现在可以接受该文件,但是只有在文件大小低于500k时才可以修复吗?