Yii Framework Forum: doubled warning that file is emprt - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

doubled warning that file is emprt when using rules: required and file type Rate Topic: ****- 1 Votes

#1 User is offline   pogoria 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 21-June 11
  • Location:Mississauga

Posted 21 June 2011 - 01:22 PM

Hi,

I am new to Yii and I am working on the form where file has to be uploaded.
I am using validation rules:
array('fileName', 'required'),
array('fileName', 'file', 'types'=>'pdf, png'),

It works fine, but when file is empty, I see warning "File Name cannot be blank." twice
I could remove first restriction, but than I am loosing red astrix, indicating that this field is mandatory.

Any tips?

Thanks

Jerzy
0

#2 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 21 June 2011 - 02:17 PM

array('fileName', 'file', 'types'=>'pdf, png', 'allowEmpty' => true),


or

array('fileName', 'file', 'types'=>'pdf, png', 'skipOnError' => true),

0

#3 User is offline   pogoria 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 21-June 11
  • Location:Mississauga

Posted 24 June 2011 - 02:02 PM

Thanks!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users