Varien_Convert_Adapter_Http Class Reference

Inheritance diagram for Varien_Convert_Adapter_Http:

Varien_Convert_Adapter_Abstract Varien_Convert_Container_Abstract Varien_Convert_Adapter_Interface Varien_Convert_Container_Interface

List of all members.

Public Member Functions

 load ()
 save ()
 loadFile ()


Detailed Description

Definition at line 35 of file Http.php.


Member Function Documentation

load (  ) 

Implements Varien_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          }
00050          return $this;
00051      }

loadFile (  ) 

Definition at line 65 of file Http.php.

00066      {
00067          if (!$_FILES) {
00068 ?>
00069 <form method="POST" enctype="multipart/form-data">
00070 File to upload: <input type="file" name="io_file"/> <input type="submit" value="Upload"/>
00071 </form>
00072 <?php
00073              exit;
00074          }
00075          if (!empty($_FILES['io_file']['tmp_name'])) {
00076             //$this->setData(file_get_contents($_FILES['io_file']['tmp_name']));
00077             $uploader = new Varien_File_Uploader('io_file');
00078             $uploader->setAllowedExtensions(array('csv','xml'));
00079             $path = Mage::app()->getConfig()->getTempVarDir().'/import/';
00080             $uploader->save($path);
00081             if ($uploadFile = $uploader->getUploadedFileName()) {
00082                 $session = Mage::getModel('dataflow/session');
00083                 $session->setCreatedDate(date('Y-m-d H:i:s'));
00084                 $session->setDirection('import');
00085                 $session->setUserId(Mage::getSingleton('admin/session')->getUser()->getId());
00086                 $session->save();
00087                 $sessionId = $session->getId();
00088                 $newFilename = 'import_'.$sessionId.'_'.$uploadFile;
00089                 rename($path.$uploadFile, $path.$newFilename);
00090                 $session->setFile($newFilename);
00091                 $session->save();
00092                 $this->setData(file_get_contents($path.$newFilename));
00093                 Mage::register('current_dataflow_session_id', $sessionId);
00094             }
00095          }
00096          return $this;
00097      } // end

save (  ) 

Implements Varien_Convert_Adapter_Interface.

Definition at line 53 of file Http.php.

00054      {
00055          if ($this->getVars()) {
00056              foreach ($this->getVars() as $key=>$value) {
00057                  header($key.': '.$value);
00058              }
00059          }
00060          echo $this->getData();
00061          return $this;
00062      }


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

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