开发者

copy() function doesn't work

I have task to copy my file from a folder to the current one. But when I perform this I get the following error:

Warning:  copy(C:/wamp/www/dfms/) [function.copy]: failed to open stream:
Permission denied in C:\wamp\www\dfms\docShow.php on line 646

The code is given below

if (copy('images/uploads/'.$doclisting['docfile_name'], 'C:/wamp/www/dfms/'))
{
  echo "Pranav";
}

I also tried by using chmod 077开发者_如何学编程7 but still it gives me same error


You are on a windows server, which means that chmod 0777 will probably not do much.


What you need to do is give Apache the permission to write to C:/wamp/www/dfms/ -- doing so the windows way.

Not sure about a Windows server, but I'm guessing right-clicking on that directory, choosing Properties, findind some "permission" or "security" tab, and checking some checkbox that corresponds to "write" for the correct user should do the trick.


Have you tried adding the filename to the destination?

Like so:

if(copy('images/uploads/'.$doclisting['docfile_name'],'C:/wamp/www/dfms/'.$doclisting['docfile_name']))
  {
    echo "Pranav";
  }


chmod 0777 is a unix command, I'd be curious how you successfully tried this on windows.

Check these file and directory access control. You should make sure that the webserver process/user has the rights to this directory.


Make sure you have "allow_url_fopen = On" in your php.ini

The php.ini file is where you declare changes to your PHP settings. You can edit the existing php.ini, or create a new text file in any subdirectory and name it php.ini.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜