We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

how to add more file types | Forum

dudi
dudi Dec 9 '15
how to add jpg,png etc ???

{
    public function __construct()
    {
        parent::__construct( 'photoverifiUpload' );
       
        $this->setAjax( FALSE );
        $this->setAction( OW::getRouter()->urlForRoute('photoverifi.upload') );
        $this->setEnctype( Form::ENCTYPE_MULTYPART_FORMDATA );
       
        $file = new FileField( 'photo' );
        $file->setRequired();
        $file->addValidator( new JpegValidator() );
        $file->setLabel( OW::getLanguage()->text('photoverifi', 'file_label') );
        $this->addElement( $file );

        $submit = new Submit( 'send' );
        $submit->setValue( OW::getLanguage()->text('photoverifi', 'submit_btn_caption') );
        $this->addElement( $submit );
    }
   
    public function isValid( $data = NULL )
    {
        return ( !empty($_FILES['photo']) && $_FILES['photo']['error'] === 0 && $_FILES['photo']['type'] == 'image/jpeg' );
    }
}

class JpegValidator extends OW_Validator
{
    public function isValid( $value )
    {
        return preg_match( '/jpg$/', $value );
    }
   
    public function getJsValidator()
    {
        return '{
            validate : function( value )
            {
                if ( !value.match("jpg$") )
                {
                    throw OW.getLanguageText("photoverifi", "upload_type_error");
                }
            }
        }';
    }
}
ryhdr
ryhdr Feb 5 '23
Your Facebook page will now not be banned for buying Facebook likes. Facebook's terms of carrier don't really restrict shopping for likes find contacts on instagram. They do attempt to ban faux money owed, however. If a big quantity of your likes are fake, you may lose them if Facebook catches them and bans their bills.