note 56937 deleted from function.file-exists by cmb
| From: | cmb@php.net | Date: | Sun, 29 Sep 2019 07:13:46 +0000 |
| Subject: | note 56937 deleted from function.file-exists by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212380@lists.php.net to get a copy of this message | ||
Note Submitter: phenbach at phenbach dot com
----
I recently had an issue with PLESK and copying file to other directories with the move_uploaded file
function.
This would work on every linux server except plesk servers. I could figure it out and have yet to
find out. I had to create a work a round and decided to use the exec() function.
As noted above the file_exist() function must need to wait for some time and I found the looking
function a waste of resouces and didn't work for me anyway. So this is what I came up with.
function cp($source,$destination){
$cmd="cp -u ".$source ." ".$destination; //create the command string to copy
with the update option
exec($cmd); //exec command
$cmd_test="ls -la ".$destination; //list file
exec($cmd_test,$out);
//If the file is present it $out[0] key will contain the file info.
//if it is not present it will be null
if (isset($out[0])){
return true;
}else{
return false;
}
}