Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - sfValidatorFile 'mime_type' validation not working in production server -


i've built backend couple of models, 1 of them, products, supports image uploading. locally file uploading works fine. when did deploy, stopped working: form validation fails because of wrong mime type (error is: "invalid mime type (jpeg image data, exif standard).") image field, when i'm using same jpg image used test locally.

i'll show form class code:

class productform extends baseproductform {   public function configure()   {     ...      /* widgets */     ...     $this->widgetschema['image_1'] = new sfwidgetforminputfileeditable(array(       'file_src' => '/'.basename(sfconfig::get('sf_upload_dir')).'/products/normal_'.$this->getobject()->getimage_1(),       'is_image' => true,       'edit_mode' => strlen($this->getobject()->getimage_1()) > 0,       'delete_label' => 'remover el archivo actual',       'template'  => '<div>%file%<br />%input%</div>'     ));     ...      /* validators */     $this->validatorschema['image_1'] = new sfvalidatorfileimage(array(       'required' => (! $this->getobject()->getimage_1()),       'max_size' => '5252880',       'path' => sfconfig::get('sf_upload_dir').'/products/original',       'mime_types' => 'web_images',       'min_width' =>  470,       'max_width' => 99999,       'min_height' =>  306,       'max_height' => 99999,       'validated_file_class' => 'sfresizedfile',   // class creates thumbnails     ), array(       'required' => 'ten&eacute;s que seleccionar una imagen principal.',       'max_size' => 'el tama&ntilde;o m&aacute;ximo es 5 mb',       //'mime_types' => 's&oacute;lo se permiten im&aacute;genes para web (jpg, png, gif)',       'invalid_image' => '%value% no es un archivo de imagen.',       'min_width' => 'el ancho de "%value%" es muy chico (mínimo %min_width% pixels).',       'min_height' => 'el alto de "%value%" es muy chico (mínimo %min_height% pixels).',     ));     $this->validatorschema['image_1_delete'] = new sfvalidatorpass();     ...   }   ... 

sfvalidatorfileimage custom validator class extends sfvalidatorfile size checks. i've tried regular sfvalidatorfile class in case, error persists. mime types have server configuration? , why break on regular web server?

speed in answer appreciated since needed deployed today.

the solution find commenting first item in array of "mime_type_guessers" option of sfvalidatorfile class, 1 reads "guessfromfileinfo", specifically. here code:

(lib/vendor/symfony/lib/validator/sfvalidatorfile.class.php - line 62 aprox.)

$this->addoption('mime_type_guessers', array(   //array($this, 'guessfromfileinfo'),   array($this, 'guessfrommimecontenttype'),   array($this, 'guessfromfilebinary'), )); 

also, copying file lib/ , commenting line in file didn't worked, symfony did used 1 in lib/vendor/symfony/lib/ did change there.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -