fields( Field::inst('id'), Field::inst('code'), Field::inst('name'), Field::inst('holdings'), Field::inst('logo') ->setFormatter( Format::ifEmpty( null ) ) ->upload( Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/__NAME__' ) ->db( 'files', 'id', array( 'filename' => Upload::DB_FILE_NAME, 'filesize' => Upload::DB_FILE_SIZE, 'web_path' => Upload::DB_WEB_PATH, 'system_path' => Upload::DB_SYSTEM_PATH ) ) ->validator( Validate::fileSize( 50000000, 'Files must be smaller than 50MB' ) ) ->validator( Validate::fileExtensions( array( 'jpg', 'jpeg', 'png' ), "Please upload PDF only" ) ) ), ) ->process($_POST) ->json();