[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

How do I get the error message for the extension validation rule to display?

Asked by millmatic in PHP Frameworks, PHP and Databases, PHP Scripting Language

Hi,

I am new to CakePHP and I am having trouble getting the extension error message to display. The error message for the email rule displays fine when someone enters an improperly formatted email and I tried other examples of Cake's built in validation, they all seem to work fine except for the extension validation.  Can someone please tell me what I am doing wrong.

Here are the validation rules in my model:
  var $validate = array(
    'imageupload' => array(
        'rule' => array('extension', array('gif', 'jpeg', 'png', 'jpg'),
        'message' => 'Please supply a valid image.'
        )
        )
        ,
'email'=>array(
'rule'=>'email',
'message'=>'Please enter a proper email'
        )
    );


Here is the snippet code in the Controller:
   function add(){
        if (!empty($this->data)) {
           
            if($this->Student->save($this->data)){
               
                $this->flash('Success','/add');
            }
        }
    }

Finally the snippet code in my view:
<?PHP
echo $form->create('Student',array('type' => 'file'));
echo $form->input('email');
echo $form->file('imageupload');
echo $form->end('Add');
?>

Again, the display message for the email displays correctly so I know that the validation is working at least somewhat.  The validation for the file upload seems to operate correctly. If I try to upload a file with a .DOC extension the "save" fails except that it does not display the error message at all.

Please help.... what am I doing wrong?
[+][-]03/06/09 08:43 AM, ID: 23818384Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03/08/09 10:40 AM, ID: 23830300Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03/12/09 02:48 PM, ID: 23874039Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03/28/09 04:53 PM, ID: 24010837Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP Frameworks, PHP and Databases, PHP Scripting Language
Sign Up Now!
Solution Provided By: MasonWolf
Participating Experts: 1
Solution Grade: A
 
[+][-]04/24/09 03:08 PM, ID: 24229735Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625