Re: Can't use copy() to copy files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben Stones wrote:
> Ok, here is my code (mind it is a bit messy I was just testing to see if it
> works first of without success):
> 
> if($_GET['act'] == "update") {
>   $check_exists=file_exists($_GET['file']);
>   if($check_exists==1) {
>    if(copy($_GET['file'],$_GET['file'])) {
>     echo 5;
>    }
>    else {
>     echo $_GET['file'];
>    }
>   }
>  }
> 
> Obviously it doesn't echo 5, it just echo's the file name which is a sign it
> isn't copying. If I change it to: copy($_GET['file'],"Hello/".$_GET['file'])
> it copies file, and sure enough I check the directory to find it has copied
> too. This code is in a seperate directory and I have changed both that
> directory, the Hello directory and the file being copied to 777 permissions
> but no luck. I noticed the following in the error_log:
> 
> [14-Oct-2008 18:07:38] PHP Warning:  copy(/index.php) [<a
> href='function.copy'>function.copy</a>]: failed to open stream: Permission
> denied in /home/vinat/public_html/Files/test.php on line 31
> Any help appreciated!
> 

your source and destination are the same.  you can't do that.  Even windows
cries when you try that.. :)

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux