0

这行代码在本地对我有用:

$copythumb = copy($externalsource, getcwd().'\\img\\covers\\'.$id.'thumb.jpg');
if (!$copythumb) {echo 'Couldn\'t add thumbnail';}  

但是当我将它上传到我的服务器时,我只是得到“无法添加缩略图”并且它没有被复制。我试图改变\\img\\covers\\/img/covers/但没有运气。我也搞砸dirname(realpath(__FILE__))$_SERVER['DOCUMENT_ROOT']

当地的:

echo getcwd(); //returns D:\Server\www\project

服务器:

echo getcwd(); //returns /storage/content/xx/xxxxxx/xxx.com/public_html/project

如果有人可以提供任何帮助,将非常感激!

4

1 回答 1

0

更改您的 img 或覆盖目录权限

<?php
// Read and write for owner, nothing for everybody else
chmod("/somedir/somefile", 0600);

// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);

// Everything for owner, read and execute for others
chmod("/somedir/somefile", 0755);

// Everything for owner, read and execute for owner's group
chmod("/somedir/somefile", 0750);
?>
于 2012-11-29T04:02:49.520 回答