On the TutsPlus.com site there’s a new installment in their "How to Program With Yii2 Series" looking at implementing file uploads with some simple examples.
In this How to Program With Yii2 series, I’m guiding readers in use of the Yii2 Framework for PHP. In this tutorial, I’ll guide you through the basics of uploading files and images in Yii2.
For these examples, we’ll continue to imagine we’re building a framework for posting simple status updates, e.g. our own mini-Twitter. The image above demonstrates writing a short update while uploading a picture I took of the Taj Mahal.
They start with a look at some of the file upload plugins that seemed like the best they found to use with Yii2: FileInput and the 2Amigos BlueImp File Uploader. They go with the first option for the rest of the tutorial, showing you how to get it installed (via Composer), updating your current database tables and changing the model to reflect these updates. Next they help you create the view with the image upload form and one to display the image result once the upload is successful (including the controller code needed).