common/services/resources/FileService.php
public function create( $model, $config = [] ) {

		// model class
		$modelClass = static::$modelClass;

		// Default visibility
		if( !isset( $model->visibility ) ) {

			$model->visibility = File::VISIBILITY_PUBLIC;
		}

		$model->siteId	= isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId;

		// Default sharing
		if( !isset( $model->shared ) ) {

			$model->shared = false;
		}

		// Create File
		$model->save();

		// Return File
		return $model;
	}
public function create( $model, $config = [] ) {

		// model class
		$modelClass = static::$modelClass;

		// Default visibility
		if( !isset( $model->visibility ) ) {

			$model->visibility = File::VISIBILITY_PUBLIC;
		}

		$model->siteId	= isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId;

		// Default sharing
		if( !isset( $model->shared ) ) {

			$model->shared = false;
		}

		// Create File
		$model->save();

		// Return File
		return $model;
	}
public function create ( $ model , $ config = [ ] ) { // model class $ modelClass = static :: $ modelClass ; // Default visibility if ( ! isset ( $ model -> visibility ) ) { $ model -> visibility = File :: VISIBILITY_PUBLIC ; } $ model -> siteId = isset ( $ config [ 'siteId' ] ) ? $ config [ 'siteId' ] : Yii :: $ app -> core -> siteId ; // Default sharing if ( ! isset ( $ model -> shared ) ) { $ model -> shared = false ; } // Create File $ model -> save ( ) ; // Return File return $ model ; }
It create the file with visibility set to public by default. It also disallow the file to be shared among multiple models.
If file sharing is set to false, it will be deleted with model and can't be browsed using file browser.
It create the file with visibility set to public by default . It also disallow the file to be shared among multiple models . If file sharing is set to false it will be deleted with model and can t be browsed using file browser .