php rename()函数权限被拒绝甚至文件夹权限是775

时间:2015-09-15 04:39:21

标签: php linux ubuntu permissions command-line-interface

我使用php rename()函数将文件从/home/vsftpd/移动到home/photo/upload。每个文件夹都在www-data组中,并且已经chmod按组写入。 但每次我运行我的脚本时,它总是说:

 PHP Warning:  rename(/home/vsftpd/arie.heptabyte@gmail.com/bebas.jpg,/home/photo/upload/55f1185a129595b9bf8b4570/tmp/111DF153189852CDBC505B223ACED5F0F8B1416264E798E98B01C5112A75CD5C.jpg): Permission denied in /var/www/photoclient/cli/ftp.php on line 71

Warning: rename(/home/vsftpd/arie.heptabyte@gmail.com/bebas.jpg,/home/photo/upload/55f1185a129595b9bf8b4570/tmp/111DF153189852CDBC505B223ACED5F0F8B1416264E798E98B01C5112A75CD5C.jpg): Permission denied in /var/www/photoclient/cli/ftp.php on line 71
  

这里我的代码在第71行,其他行只是将数据分配到其他部分

   rename ('/home/vsftpd/arie.heptabyte@gmail.com/bebas.jpg', '/home/photo/upload/55f1185a129595b9bf8b4570/tmp/111DF153189852CDBC505B223ACED5F0F8B1416264E798E98B01C5112A75CD5C.jpg');
  

这是文件夹权限信息

drwxrwxr-x  3 photo  www-data 4096 Sep  7 13:51 photo
drwxrwxr-x  4 vsftpd www-data 4096 Sep 14 10:57 vsftpd

我想知道,这里有什么问题?

  

与此问题类似的其他帖子只是说改变了   父文件夹的权限。我已经完成了。

感谢

1 个答案:

答案 0 :(得分:1)

尝试向源文件夹和目标文件夹授予var allowSubmit = false; $('#my_form').on('submit', function(e) { if (!allowSubmit) { e.preventDefault(); // Check to see if input data is malformed: $.get('error_check.php', { new_element_name: $('#new_element_name').val() }, function(data) { if (data != 0) { alert("An Error Message that explains what's wrong with the form data"); } else { allowSubmit = true; // The line below--an auto-submit--is needed so we don't have to press the submit button TWICE. // The variable allowSubmit is set to TRUE whenever the submitted form data is good, // but the code suppressed by e.preventDefault() won't execute until the form is // submitted a second time...hence the need for this programmatic form submission here. // This allows the user to correct the errant form data, press the submit button ONCE and continue. $('#my_form').submit(); } }); } $('#element_name').val($('#new_element_name').val()); }); 755权限