示例#1
0
 public function uploadcontactsAction()
 {
     if (!isset($_FILES['import']) && !isset($_FILES['import']['tmp_name'])) {
         throw new Exception("Import file not found");
     }
     $fname = $_FILES['import']['tmp_name'];
     $contacts = null;
     try {
         $contacts = $this->clientService->importContacts($fname);
     } catch (ContactImportException $cie) {
         $msg = array("Imported " . count($contacts) . " contacts, " . count($cie->errors) . " not imported.", $cie->errors);
         $this->flash($msg);
         $this->redirect('contact', 'contactimport');
         return;
     }
     $this->flash("Imported " . count($contacts) . " contacts");
     $this->redirect('contact');
 }