public function save($dir, $filename = null)
    {
        // clean
        $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        if(!$filename) {
            $filename = $this->name;
        }

        return move_uploaded_file($this->tmp, $dir . $filename);
    }
public function save($dir, $filename = null)
    {
        // clean
        $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        if(!$filename) {
            $filename = $this->name;
        }

        return move_uploaded_file($this->tmp, $dir . $filename);
    }
public function save ( $ dir , $ filename = null ) { // clean $ dir = rtrim ( $ dir , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; if ( ! $ filename ) { $ filename = $ this -> name ; } return move_uploaded_file ( $ this -> tmp , $ dir . $ filename ) ; }
Save file to directory

@param string $dir
@param string $filename

@return bool
Save file to directory