Is there any way to check if file has been uploaded completely on the server? My scenario: User uploads file over ftp and my other PHP task is running in cronjob. Now I would li
if you are running php on linux then lsof can help you
$output = array();
exec("lsof | grep file/path/and/name.ext",$output);
if (count($output)) {
echo 'file in use';
} else {
echo 'file is ready';
}
EDIT: in case of permission issue. by using sudo or suid methods php script can get required permissions to execute lsof command. to set suid you have to issue following command as root.
su root
chmod u+s /usr/sbin/lsof