Mage_Dataflow_Model_Session_Adapter_Http Class Reference

Inheritance diagram for Mage_Dataflow_Model_Session_Adapter_Http:

Mage_Dataflow_Model_Convert_Adapter_Abstract Mage_Dataflow_Model_Convert_Container_Abstract Mage_Dataflow_Model_Convert_Adapter_Interface Mage_Dataflow_Model_Convert_Container_Interface

List of all members.

Public Member Functions

 load ()


Detailed Description

Definition at line 35 of file Http.php.


Member Function Documentation

load (  ) 

Implements Mage_Dataflow_Model_Convert_Adapter_Interface.

Definition at line 37 of file Http.php.

00038      {
00039          if (!$_FILES) {
00040 ?>
00041 <form method="POST" enctype="multipart/form-data">
00042 File to upload: <input type="file" name="io_file"/> <input type="submit" value="Upload"/>
00043 </form>
00044 <?php
00045              exit;
00046          }
00047          if (!empty($_FILES['io_file']['tmp_name'])) {
00048             //$this->setData(file_get_contents($_FILES['io_file']['tmp_name']));
00049             $uploader = new Varien_File_Uploader('io_file');
00050             $uploader->setAllowedExtensions(array('csv','xml'));
00051             $path = Mage::app()->getConfig()->getTempVarDir().'/import/';
00052             $uploader->save($path);
00053             if ($uploadFile = $uploader->getUploadedFileName()) {
00054                 $session = Mage::getModel('dataflow/session');
00055                 $session->setCreatedDate(date('Y-m-d H:i:s'));
00056                 $session->setDirection('import');
00057                 $session->setUserId(Mage::getSingleton('admin/session')->getUser()->getId());
00058                 $session->save();
00059                 $sessionId = $session->getId();
00060                 $newFilename = 'import_'.$sessionId.'_'.$uploadFile;
00061                 rename($path.$uploadFile, $path.$newFilename);
00062                 $session->setFile($newFilename);
00063                 $session->save();
00064                 $this->setData(file_get_contents($path.$newFilename));
00065                 Mage::register('current_dataflow_session_id', $sessionId);
00066                 /*
00067                 $read = @fopen($path.$newFilename, "r");
00068                 if ($read) {
00069                     $i = 0;
00070                     while (!feof($read)) {
00071 
00072                         $buffer = fgets($read, 4096);
00073                         $import = Mage::getModel('dataflow/import');
00074                         $import->setSerialNumber($i);
00075                         $import->setSessionId($sessionId);
00076                         $import->setSessionId($value);
00077                         $i++;
00078                     }
00079                     fclose($read);
00080                 }
00081                 */
00082             }
00083          }
00084          return $this;
00085      }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:06 2009 for Magento by  doxygen 1.5.8