Ftp Upload Via Web Form In Codeigniter

Wednesday, November 12, 2008

Just recently i've managed to use Codeigniter's FTP class to upload file from my admin page,using web form that is, the concept is easy
first,took the file path using Codeigniter's Upload Class (Ftp Class won't get the full path)
second,upload it using FTP (code igniter also have its own Ftp Class)

in order to do so ,i've modified my upload class ,so that it will upload uisng ftp instead of moving file
here's the line of interest

if ( !$CI->ftp->upload($this->file_temp, $this->upload_path.$this->file_name))
return FALSE;

don't forget to load the ftp library n get it connected like this

$CI =& get_instance();
if( $CI->ftp->connect())

n thats it,now you can use Codeigniter's Ftp class to upload file from a web form :D


  © Blogger template Newspaper by Ourblogtemplates.com 2008

Back to TOP