note 56937 added to function.file-exists
| From: | phenbach at phenbach dot com | Date: | Mon, 19 Sep 2005 22:37:36 +0000 |
| Subject: | note 56937 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95438@lists.php.net to get a copy of this message | ||
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;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.file-exists.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56937
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56937&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56937&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56937&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56937&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56937&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+56937&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56937&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56937&report=yes
Search -- http://master.php.net/manage/user-notes.php