Difference between #2 and #3 of
Upload CSV File

Revision #3 has been created by bhavesh vaghela on Oct 15, 2014, 10:25:51 AM with the memo:

Formating changes
« previous (#2)

Changes

Title unchanged

Upload CSV File

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

View file            $form=$this->beginWidget('CActiveForm', array(         'id'=>'registration-form',          'enableAjaxValidation'=>true,               'htmlOptions' => array('enctype' => 'multipart/form-data'), )); 
 
 
<div >
 
 
 
            )); 
 
 
             
<div> <?php echo $form->labelEx($model,'csv_file'); ?>
 
<?php echo $form->fileField($model,'csv_file'); ?> <?php echo $form->error($model, 'csv_file'); ?>
 
</div> <hr> <?php echo CHtml::submitButton('Upload CSV',array("class"=>"")); ?> <?php echo $form->errorSummary($model); ?>
 
</div>             $this->endWidget();
 
Model file
 
                
public function rules() {
 
        {
 
   
 array('csv_file',  'file', 'types' => 'csv',  'maxSize'=>5242880,  'allowEmpty' => true,  'wrongType'=>'Only csv allowed.',  'tooLarge'=>'File too large! 5MB is the limit'),        }               public function attributeLabels() {
 
      {
 
   
'csv_file'=>'Upload CSV File',        }

Controller file


public function actionImport() {
[...]
3 0
10 followers
Viewed: 32 663 times
Version: 1.1
Category: Tutorials
Tags:
Written by: bhavesh vaghela
Last updated by: bhavesh vaghela
Created on: Jan 9, 2013
Last updated: 10 years ago
Update Article

Revisions

View all history