Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

so i can set the fileRoot on PHP side with:

PHP
$fm->setFileRoot('data/test/')


this works just fine. I can uplod and navigate in trough my files and directorys.

There is a function in filemanager.class.php

PHP
private function getFullPath($path = '') {
    if($path == '') {
        $path = $this->get['path'];
    }
    error_log('GetPath: '.$path);
    if($this->config['options']['fileRoot'] !== false) {
        error_log('DOC_ROOT: '.$this->doc_root.' - PATH:'.$path);
        $full_path = $this->doc_root . rawurldecode(str_replace ( $this->doc_root , '' , $path));
    } else {
        $full_path = $this->doc_root . rawurldecode($path);
    }

    $full_path = str_replace("//", "/", $full_path);

    //$this->__log(__METHOD__. " path : " . $full_path);
error_log(__LINE__.' :FULLPATH: '.$full_path);
    return $full_path;

}



on navigation this gives me always the right paths back like:
PHP
error_log()

[Tue Jun 04 11:02:29 2013] [error]GetPath: /Penguins.jpg, 
[Tue Jun 04 11:02:29 2013] [error]DOC_ROOT: /www/cms-tba//data/test/ - PATH:/Penguins.jpg,
[Tue Jun 04 11:02:29 2013] [error]550 :FULLPATH: /www/cms-tba/data/test/Penguins.jpg,


but when i try to delete the file, or ranem or what ever:
i get this:
PHP
[Tue Jun 04 11:10:45 2013] [error] [client 192.168.2.188] GetPath: /data/test/Penguins.jpg, 
[Tue Jun 04 11:10:45 2013] [error] DOC_ROOT: /www/cms-tba//data/test/ - PATH:/data/test/Penguins.jpg, 
[Tue Jun 04 11:10:45 2013] [error]550 :FULLPATH: /www/cms-tba/data/test/data/test/Penguins.jpg,


the full path at the end from where he is supposed to delete the file is wrong.
If i dont use the setFileRoot function and just set the fileRoot in the js config file everything is working.

Im realy clueless at this moment. I dont know ehere he gets the path:
PHP
GetPath: /data/test/Penguins.jpg,
when i want to delete.



C#
public function setFileRoot($path) {

    if($this->config['options']['serverRoot'] === true) {
        $this->doc_root = $_SERVER['DOCUMENT_ROOT']. '/'.  $path;
    } else {
        $this->doc_root =  $path;
    }

    // necessary for retrieving path when set dynamically with $fm->setFileRoot() method
    $this->dynamic_fileroot = str_replace($_SERVER['DOCUMENT_ROOT'], '', $this->doc_root);

    $this->__log(__METHOD__ . ' $this->doc_root value overwritten : ' . $this->doc_root);
    $this->__log(__METHOD__ . ' $this->dynamic_fileroot value ' . $this->dynamic_fileroot);
}
Posted
Updated 4-Jun-13 0:08am
v4

1 solution

/www/cms-tba// <-- Maybe this
 
Share this answer
 
Comments
T0mii 4-Jun-13 5:35am    
no, the script is fine with that.
The problem is i get this /data/test/Penguins.jpg instead of this /Penguins.jpg

and so he builds the wrong fullpath ...data/test/data/test....
M@dHatter 4-Jun-13 5:38am    
So you have a directory called nothing? //
T0mii 4-Jun-13 5:44am    
$full_path = str_replace("//", "/", $full_path); this gets rid of the double slash problem.

Its cause in the js config file i have to set a "/" And on the end of the root www/cms-tba/ is a "/" as well
M@dHatter 4-Jun-13 5:52am    
Is this where the file is located?
FULLPATH: /www/cms-tba/data/test/data/test/Penguins.jpg
or
FULLPATH: /www/cms-tba/data/test/Penguins.jpg
T0mii 4-Jun-13 5:56am    
its located here FULLPATH: /www/cms-tba/data/test/Penguins.jpg,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900