Пример #1
0
 public static function import($group, $file)
 {
     if (is_uploaded_file($file['tmp_name'])) {
         $parts = pathinfo($file['name']);
         if (isset($parts['extension']) && $parts['extension'] == 'csv') {
             include dirname(dirname(__FILE__)) . '/fileio/csv.php';
             $importer = new Red_Csv_File();
             $data = '';
         } else {
             include dirname(dirname(__FILE__)) . '/fileio/apache.php';
             $importer = new Red_Apache_File();
             $data = @file_get_contents($file['tmp_name']);
         }
         return $importer->load($group, $data, $file['tmp_name']);
     }
     return 0;
 }
Пример #2
0
 function import($group, $file)
 {
     if (is_uploaded_file($file['tmp_name'])) {
         $parts = pathinfo($file['name']);
         if ($parts['extension'] == 'xml') {
             include dirname(__FILE__) . '/../fileio/xml.php';
             $importer = new Red_Xml_File();
         } else {
             if ($parts['extension'] == 'csv') {
                 include dirname(__FILE__) . '/../fileio/csv.php';
                 $importer = new Red_Csv_File();
             } else {
                 include dirname(__FILE__) . '/../fileio/apache.php';
                 $importer = new Red_Apache_File();
             }
         }
         $data = @file_get_contents($file['tmp_name']);
         return $importer->load($group, $data);
     }
     return 0;
 }