CodeIgniter Forums
Help with FTP library local path - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Help with FTP library local path (/showthread.php?tid=42676)



Help with FTP library local path - El Forum - 06-15-2011

[eluser]marcogmonteiro[/eluser]
Hi there,
here's my problem:

I'm building something like a filemanager. But the Filemaganer is in one place and the files will be stored in another.

I've been reading the documentation on how to accomplish this. And I'm using the FTP Class...
List files and folders from external ftp = Done
my problem is on the uploading part.

The documentation says:
Code:
$this->ftp->upload('/local/path/to/myfile.html', '/public_html/myfile.html', 'ascii', 0775);
but how can I get the local path since php is a server side language?

My 1st thought was to try the $_FILES array and check for that path but no luck. That only gives me the tmp path and if I try to upload that it returns an error:

An Error Was Encountered
Unable to upload the specified file. Please check your path.

is there a solution for this?

thanks in advance...


Help with FTP library local path - El Forum - 06-15-2011

[eluser]toopay[/eluser]
[quote author="cancerman" date="1308163088"]
but how can I get the local path since php is a server side language?
[/quote]
Whats that really mean? Off course you can. Otherwise, some "client-side" languange (or semantic languange) like javascript, is can't retrieve full path of a file (or the real path to the file will be shown only if the page that contains the control is added to the trusted sites collection of the browser).

For your task, try pathinfo() function.


Help with FTP library local path - El Forum - 06-15-2011

[eluser]marcogmonteiro[/eluser]
I'll check it later today.

Thanks mate!


Help with FTP library local path - El Forum - 06-16-2011

[eluser]marcogmonteiro[/eluser]
I have another problem now. I need to list all the files on a specific folder. No problem there. But I need to show the files in a specific order. More recent to older file. What is the default order?