So I followed the directions on uploading a file correctly and instead of uploading or doing anything, after I submit the form, it will reload the page again but with all fields cleared out.
Here is my form:
At the top I have:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'video-form',
'enableAjaxValidation'=>false,
'htmlOptions'=>array('enctype'=>'multipart/form-data'),
)); ?>
Then:
<div class="row">
<?php echo $form->labelEx($model,'filename'); ?>
<?php echo CHtml::activeFileField($model, 'filename'); ?>
</div>
My controller looks like:
public function actionCreate()
{
$model=new Video;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Video']))
{
$model->attributes=$_POST['Video'];
$model->date_created = date('l jS \of F Y h:i:s A');
$model->uploader = Yii::app()->user->id;
$model->filename = CUploadedFile::getInstance($model,'filename');
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
));
}
And of course my model has this:
array('filename', 'file', 'types'=>'flv', 'allowEmpty' => false),
Any ideas on why its just reloading the form?
Edit: Looks like a few files types such as flv, wmv, and some others are causing my form to reset even if I have a filter for it.