• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FTP/SFTP in CodeIgniter

I'm developing an application that will need to transfer files. I don't know at the moment if will be an FTP or a SFTP protocol. How do you think I should design it using CodeIgniter? Is there an SFTP class in CI?

[eluser]Mauricio de Abreu Antunes[/eluser]
No, CI has no SFTP implementation.

Look his lib and create your own. Smile
I can help you if you need, i would be glad to help.

Hi thanks!
My idea was to develop a wrapper class so that I can use it in this sort of way but having of course both FTP and SFTP implementation behind it.

$transfer = new Transfer();
$transfer->upload('/local/this.txt', '/remote/this.txt');

My idea was to name methods like this

private function _ftp_connect()
private function _sftp_connect()

and call them based on a config file using __call....

Is this a good approach?

[eluser]Mauricio de Abreu Antunes[/eluser]
My idea:
1 - Watch for the difference between STFP and FTP.
2 - Try to construct a lib with a parent class, reusing common methods (SFTP and FTP).

Good luck and have fun!

Thanks for the tip! Will do.

You might also wanna have a look at CI-Drivers. That's probably better fitting your needs. And in terms of the idea of drivers and libraries, a driver fits much better Wink

This would be just right for creating a CI Driver class.

CodeIgniter User Guide - Using CodeIgniter Drivers

CodeIgniter User Guide - Creating Drivers

LOL @PhilTem lookat post times...

[eluser]Mauricio de Abreu Antunes[/eluser]
@PhilTem and @InsiteFx

Are you brothers? HAHA!

Anyway, tell me: why is CI Driver better than CI Lib?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.