Copy() method in php are not working

Hello I have a problem in using copy() in php.

I have a text file declared in a variable then It was located temporarily in my “temp” folder located at my C: driver.
then I want the txt file to pass to another folder named “sales”.

When I run the code is not passing the file from the temp folder to the sales folder.

here is the code:
<?php
$text = “LSPI_PSPAYM_7790.txt”;
//$file = “C://temp/”.$text.“”;
//$newfile = “C:/sales/”.$text.“”;
$flgcopy = copy(“file://C:/temp/”.$text.“”,“file://C:/sales/”.$text.“”);
if($flgcopy)
{
echo"Success";

}
?>

any help and comments are appreciated. thank you :slight_smile:

Check file_exists() and also file and directory permissions, using chmod().

Try also setting error_reporting(-1) and ini_set(‘display_errors’ , true); may give you more information.

Ensure the file is there using file_exists().

Check file and directory permissions using chmod().

Setting error_reporting(-1) and ini_set(‘display_errors’, true) will give more information on why the copy failed.

Try the manual because there are lots of other solutions.
http://www.php.net//manual/en/function.copy.php

Ubuntu is my current OS using at my office. I try this at my home at my laptop and it is working perfectly but here in office it does not worked anymore. :frowning: