How we can save a image in a folder yii2 framework?
问题 When i am uploading a image it is saved in default folder that is /web. I want to save my images in user defined folder. 回答1: If its a user defined folder, chances are pretty good you will have to create the directory on the fly, which the UploadedFile method does not do. For Yii2 I would use the createDirectory() method in the "yii\helpers\BaseFileHelper" class. ex: use yii\web\UploadedFile; use yii\helpers\BaseFileHelper; $model->uploaded_file = UploadedFile::getInstance($model, 'uploaded