Hello,
was working on "how to fix delete, replace a file", and as someone already said, using the commented lines below from getFullPath function make it work :
$dynPart = str_replace($_SERVER['DOCUMENT_ROOT'], '', $this->path_to_files); $full_path = $this->path_to_files . rawurldecode(str_replace ( $dynPart , '' , $path));
The point is, I couldn't rename a file either, and I think I found a tiny mistake, guess was from source too, but calling the rename function also call is_valid_path for both the old name and for the new one.
The issue comes with the new name,
realpath() returns FALSE on failure, e.g. if the file does not exist. (php manual)
, swap both calls substr and realpath the way below fixed it.
$substrpath = substr(realpath($path) . DIRECTORY_SEPARATOR, 0, strlen($this->path_to_files)) . DIRECTORY_SEPARATOR;
by
$substrpath = realpath(substr($path . DIRECTORY_SEPARATOR, 0, strlen($this->path_to_files))) . DIRECTORY_SEPARATOR;
apparently, everything is working fine with that update..
Hello,
was working on "how to fix delete, replace a file", and as someone already said, using the commented lines below from
getFullPathfunction make it work :$dynPart = str_replace($_SERVER['DOCUMENT_ROOT'], '', $this->path_to_files); $full_path = $this->path_to_files . rawurldecode(str_replace ( $dynPart , '' , $path));The point is, I couldn't rename a file either, and I think I found a tiny mistake, guess was from source too, but calling the
renamefunction also callis_valid_pathfor both the old name and for the new one.The issue comes with the new name,
, swap both calls
substrandrealpaththe way below fixed it.$substrpath = substr(realpath($path) . DIRECTORY_SEPARATOR, 0, strlen($this->path_to_files)) . DIRECTORY_SEPARATOR;by
$substrpath = realpath(substr($path . DIRECTORY_SEPARATOR, 0, strlen($this->path_to_files))) . DIRECTORY_SEPARATOR;apparently, everything is working fine with that update..