*/ class Mage_Dataflow_Model_Session_Adapter_Http extends Mage_Dataflow_Model_Convert_Adapter_Abstract { public function load() { if (!$_FILES) { ?>
File to upload:
setAllowedExtensions(array('csv','xml')); $path = Mage::app()->getConfig()->getTempVarDir().'/import/'; $uploader->save($path); if ($uploadFile = $uploader->getUploadedFileName()) { $session = Mage::getModel('dataflow/session'); $session->setCreatedDate(date('Y-m-d H:i:s')); $session->setDirection('import'); $session->setUserId(Mage::getSingleton('admin/session')->getUser()->getId()); $session->save(); $sessionId = $session->getId(); $newFilename = 'import_'.$sessionId.'_'.$uploadFile; rename($path.$uploadFile, $path.$newFilename); $session->setFile($newFilename); $session->save(); $this->setData(file_get_contents($path.$newFilename)); Mage::register('current_dataflow_session_id', $sessionId); /* $read = @fopen($path.$newFilename, "r"); if ($read) { $i = 0; while (!feof($read)) { $buffer = fgets($read, 4096); $import = Mage::getModel('dataflow/import'); $import->setSerialNumber($i); $import->setSessionId($sessionId); $import->setSessionId($value); $i++; } fclose($read); } */ } } return $this; } }