File upload, storage, display, and download.

Things are going smoothly in my first significant Yii development thanks to the input from forum members. Thank you.

I am now entering a section of the app development where I need to upload, store, retrieve, display and download files of all kinds. I have content types (tables) to store images, audio, video and eDocuments (all file types).

I think I would like to store the files in blobs. This is how we have historically done this when building desktop client/server style apps. I want to upload a file, store it in a blob field of a database table, retrieve it from the blob to display and/or download.

I found a brief discussion of storing files in blobs in Yii, but it was too fragmented for me to get to work.

Is this the best approach? I will be using this web app repeatedly for different sites. Some will be used for massive collaboration, so scaling must be taken into consideration.

I think I could put this together with something like the upload extension, if I wasn’t planning to put the files in blobs, but I am concerned about security, backup, and migration issues using OS directories for storage.

Ideas? Opinions? Examples? Please…



Hi Alex,

I think best approach is to store files on OS directory.You can find some more on

Example Yii file upload



//mFileEnglish is the file attribute name;