magento2 - magento 2 read csv from ftp returns a string and not an array -
i'm working magento 2, need read file through ftp connection. can login ftp cannot read csv file. did far (i cut unnecessary parts):
use magento\framework\file\csv; use magento\framework\filesystem\io\ftp; class myclass { protected $_csvprocessor; protected $_ftp; public function __construct(csv $csvprocessor, ftp $ftp) { $this->_csvprocessor = $csvprocessor; $this->_ftp = $ftp; } public function getcsv() { $conn = $this->_ftp->open($params); // works, can login ftp $filecsv = $this->_ftp->read($remotepathtofile); // gets me file string, not array csv data $this->_csvprocessor->getdata($remotepathtofile); // doesn't work remote file, local path (eg: magentoroot/var/import/file.csv) } } how can read csv array, $this->_csvprocessor->getdata() return, remote file instead of local?
Comments
Post a Comment