i need to upload a zip from my localhost to my webserver with my codeigniter application. I have followed the docs but i can't upload file, the error is:
An Error Was Encountered
Unable to locate the source file. Please check your path.
i can't figured out why it can't find the source path, if i try to test the path with file_exists it work, but with the upload method fails...
This is my code:
$this->load->library('ftp');
$config_ftp['hostname'] = 'xxxxx';
$config_ftp['username'] = 'xxxxx';
$config_ftp['password'] = 'xxxxx';
$config_ftp['debug'] = TRUE;
$this->ftp->connect($config_ftp);
if(file_exists($my_file))
echo "ok";
else
echo "no";
$this->ftp->upload($my_file , '/web/'.$my_file, 'binary');
FCPATHconstant, this will provide you the Path that contains the bootstrapindex.php. From there, you can build the path to the file you want to upload. - Gavin$my_file? Also try using absolute path if you're not doing that already. - RobertFCPATHi get the path from the localhost:/Applications/MAMP/htdocs/AllWorks/Giovanetti2012/gestionale/at this i have append the$my_filethat contains the path from thegestionalefolder to the zip file and the new path is:/Applications/MAMP/htdocs/AllWork/Giovanetti2012/gestionale/files/xml/auto/archive.zipbut it doesn't work - Christian Giupponihttp://php.net/manual/en/book.ftp.phpand it works! - Christian Giupponi