Public Member Functions | |
load () | |
save () | |
loadFile () |
Definition at line 35 of file Http.php.
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 | ( | ) |