getValue()), '/'); if (!preg_match('#^uploads(?:/[a-zA-Z0-9_-]+)*$#', $path)) { throw new LocalizedException( __('Upload Path must be "uploads" or a safe child directory of "uploads".') ); } $this->setValue($path); return parent::beforeSave(); } }