Asgaroth / xupload

XUpload extension for Yii Framework

Home Page:http://www.yiiframework.com/extension/xupload/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

subfolderVar is set but default folder is created

gherrink opened this issue · comments

Hey there I have downloaded your Project and I like it, but you have a little bug in your XUploadAction when the subfolderVar is set the default folder is created. I have searched for the Problem and found it.
You have programmed this:

if( $this->subfolderVar === null ) {
        $this->_subfolder = Yii::app( )->request->getQuery( $this->subfolderVar, date( "mdY" ) );
} else if($this->subfolderVar !== false ) {
       $this->_subfolder = date( "mdY" );
}

You have to change it to something like this:

if( $this->subfolderVar !== null && $this->subfolderVar !== "" ) {
        $this->_subfolder = Yii::app( )->request->getQuery( $this->subfolderVar, date( "mdY" ) );
} else if($this->subfolderVar !== false ) {
       $this->_subfolder = date( "mdY" );
}

You should not set subfolderVar = "", if you don't want a subfolder set it to false.

/**
     * The query string variable name where the subfolder name will be taken from.
     * If false, no subfolder will be used.
     * Defaults to null meaning the subfolder to be used will be the result of date("mdY").
     *
     * @see XUploadAction::init().
     * @var string
     * @since 0.2
     */
    public $subfolderVar;