1

I am using Symfony 1.4 and Propel as ORM. I have created a form using the Symfony Form, which contains some text inputs and file upload elements. The form structure,

$this->setWidgets(array(
            'name'            =>new sfWidgetFormInput(),
            'mobile'          =>new sfWidgetFormInput(),
            'resume'          =>new sfWidgetFormInputFile()
    ));
$mime_array=array("application/pdf","application/msword");
$this->setValidators(array(
             'name'            =>new sfValidatorString(array('required' => true)),
             'mobile'          =>new sfValidatorAnd(array(new sfValidatorNumber(),new sfValidatorString(array('required' => true, 'min_length' => 10, 'max_length' => 10)))), 
             'resume'          =>new sfValidatorFile(array('mime_types' => $mime_array))
    ));

But the file upload Validation not working for Ms Word files, but works for PDF files(as user can upload PDF or Ms Word Document).

skaffman
  • 398,947
  • 96
  • 818
  • 769
Harish Kurup
  • 7,257
  • 19
  • 65
  • 94

1 Answers1

2

Not totally sure but I think new office 2007 word docs require a different mime type:

application/vnd.openxmlformats-officedocument.wordprocessingml.document

(add that to your array to test)

I believe the other one is for older word versions.

Here's some related reading: http://www.vladville.com/2007/04/office-2007-mime-types-for-apache.html

Tom
  • 30,090
  • 27
  • 90
  • 124