public function afterSave()
    {
        if (!$this->files) {
            return true;
        }
        $oldFileCount = $this->getFileCount();
        /**
         * @var UploadedFile $file
         */
        foreach ($this->files as $key => $file) {
            $this->fileNumber = $oldFileCount + $key + 1;
            $this->fileName = $this->fileNumber . '_' . $file->name;
            if ($this->fileNumber == 1) {
                $this->owner->updateAttributes([$this->fileField => $this->fileName]);
            }
            $path = $this->getFilePath(null, $this->fileName);
            $this->createFilePath($path);
            $file->saveAs($path);
            foreach ($this->imageSettings as $name => $options) {
                $this->processImage($name, $options);
            }    
        }
    }
public function afterSave()
    {
        if (!$this->files) {
            return true;
        }
        $oldFileCount = $this->getFileCount();
        /**
         * @var UploadedFile $file
         */
        foreach ($this->files as $key => $file) {
            $this->fileNumber = $oldFileCount + $key + 1;
            $this->fileName = $this->fileNumber . '_' . $file->name;
            if ($this->fileNumber == 1) {
                $this->owner->updateAttributes([$this->fileField => $this->fileName]);
            }
            $path = $this->getFilePath(null, $this->fileName);
            $this->createFilePath($path);
            $file->saveAs($path);
            foreach ($this->imageSettings as $name => $options) {
                $this->processImage($name, $options);
            }    
        }
    }
public function afterSave ( ) { if ( ! $ this -> files ) { return true ; } $ oldFileCount = $ this -> getFileCount ( ) ; /**
         * @var UploadedFile $file
         */ foreach ( $ this -> files as $ key => $ file ) { $ this -> fileNumber = $ oldFileCount + $ key + 1 ; $ this -> fileName = $ this -> fileNumber . '_' . $ file -> name ; if ( $ this -> fileNumber == 1 ) { $ this -> owner -> updateAttributes ( [ $ this -> fileField => $ this -> fileName ] ) ; } $ path = $ this -> getFilePath ( null , $ this -> fileName ) ; $ this -> createFilePath ( $ path ) ; $ file -> saveAs ( $ path ) ; foreach ( $ this -> imageSettings as $ name => $ options ) { $ this -> processImage ( $ name , $ options ) ; } } }
Saves attached file and sets db filename field, makes thumbnails.
Saves attached file and sets db filename field makes thumbnails .