Buat import data kontak

maaf master saya lagi kebingungan nih ada yang bisa bantu gak cara membuat form import kontak untuk sms gateway…

ini file controller yang sudah di buat,

public function actionImport(){

		$model=new Contact;

		require_once Yii::app()->basePath.'/extensions/upload/excel_reader2.php';


   if (isset($_POST['ImportForm']))



     if ($a) {

       //upload file





       //Read excel to array


       $data = new Spreadsheet_Excel_Reader($path);





       $gagal= 0;

       //insert into database

       for ($j=2; $j <= $data->sheets[0]['numRows']; $j++)





             $model= new Contact;





               //hitung record



               } else {




        Yii::app()->user->setFlash('sukses',$berhasil.' record

        berhasil disimpan dan '.$gagal.' record gagal disimpan..');

        //hapus file excel

        unlink ($path);









<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(



    'htmlOptions'=> array('enctype'=>'multipart/form-data'),

)); ?>

	<p class="help-block">Fields with <span class="required">*</span> are required.</p>

        <?php echo $form->labelEx($model,'file_excel'); ?>

        <?php echo $form->Filefield($model,'file_excel'); ?>

        <?php echo $form->error($model,'file_excel'); ?>


		<div class="form-actions">

		<?php $this->widget('bootstrap.widgets.TbButton', array(



			'label'=>$model->isNewRecord ? 'Tambah' : 'Save',

		)); ?>


<?php $this->endWidget(); ?>

dan di modelnya,


	public function rules()


		// NOTE: you should only define rules for those attributes that

		// will receive user inputs.

		return array(

			array('member, contact', 'required'),

			array('member, contact', 'length', 'max'=>50),



           'allowEmpty' => true,

           'wrongType'=>'Only csv allowed.',

           'tooLarge'=>'File too large! 5MB is the limit'),


			// The following rule is used by search().

			// @todo Please remove those attributes that should not be searched.

			array('contact_id, member, contact', 'safe', 'on'=>'search'),



setelah di klik tambah gak terjadi apa-apa gak ada error, tapi datanya gak masuk. terima kasih