Can't Upload .docx Or .rtf Files

Hi,

I’m trying to upload the some .docx and rtf files. But I can’t get Yii to accept the mimeTypes. It works for .doc and text though. Not sure what is wrong, wonderd if anyone else could help. I’m using XAMPP if that helps too.

Model:


array('file', 'file', 'on' => 'insert', 'safe'=>true, 'maxSize'=> 512000, 'maxFiles'=> 1, 

			'mimeTypes' => 'application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/rtf, text/plain',

			'tooLarge'=> 'File cannot be larger than 500KB.',

			'wrongMimeType'=> 'Format must be:<code>.doc</code>  <code>.docx</code> <code>.txt</code> <code>.rtf</code>'),

I also added:




'docx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 



to the mimeTypes.php file.

Also added




application/vnd.openxmlformats-officedocument.wordprocessingml.document docx



into the apache/conf/mime.types

Any advice would be appreciated

Jonny

[size=2]Hi… I am doing using following rules in my model[/size]




array('file', 'file', 'types'=>'jpeg, jpg, pdf, txt, doc,docx, gif, png', 'maxSize'=>1024*1024*2, 'tooLarge'=>'The document was larger than 2MB. Please upload a smaller document.',),



And controller code




 $model->file = CUploadedFile::getInstance($model,'file');

 $model->file->saveAs(Yii::getPathOfAlias('webroot').'/documents/' .$model->file);

 $model->save();



That would be a less secure way to upload the files though as the extensions can be faked - Thanks for your input though