FTP Class - How can I browse ? |
[eluser]Saymont[/eluser]
Hello, Im trying to use FTP Class just to browsing my images files. So I use: Code: $this->ftp->list_files($dir); Where $dir is my FTP directory that I want to browse. Problem 01: I dont now how to swap this variable ($dir) while browsing. Example: Suppose that $dir = www Results: _____________ . .. docs images tree.jpg ______________ What kind of uri/link I insert into this values to increment www/. If I use $dir = uri_string, the beginning of sentence gonna be wrong because have another "words" there. How can I do it ? Problem 02: How can I list Folders first ? Thank you ALL
[eluser]Senthilguru[/eluser]
Hi dude, To get the files list from ftp u have to pass the path of your image folder. lets consider ur directory structure like this... public_html->test->images folder then u have to pass the path like this Code: $dir = $_SERVER['DOCUMENT_ROOT'].'/test/images/'; Have a nice day. cheers, senthilguru.e cogzideltemplates.com
[eluser]Saymont[/eluser]
hello, thank you for reply. List path is not the problem. The problem is after list.... After list the folder i want to still browser another folders. So I cant use static address like you said "/test/images/". It must be a variable because it must change every time I change the folder by clicking at the folder name. thank you
[eluser]Phil Sturgeon[/eluser]
If I am understanding this you want to be able to pass the directory as a URL parameter to browse any folder you like. Try the following: Code: <?php That means you can pass it the following URL http://example.com/browse/directory/test/images/.
[eluser]Saymont[/eluser]
Thank you for reply Pyromaniac. Your code was very useful to understand the main idea but I have an error: func_get_args(): Can't be used as a function parameter in ..... the line is: Code: $dir = func_num_args() > 0 ? implode('/', func_get_args()): "/" ; All my function is: Code: function ftp()
[eluser]Saymont[/eluser]
Lets see problem 2 now: How list FOLDERS first ???????? Problem 1 its ok::::: Code: function ftp() |
Welcome Guest, Not a member yet? Register Sign In |