Yii obtains the suffix of the uploaded file
Yii obtains the suffix of the uploaded file, mainly using the getExtensionName () method in the CUploadedFile class, for example:
<? Php ...... $ form-> image = CUploadedFile: getInstance ($ form-> model, 'image'); $ randName = date ('ymdhis '). rand (100,999 ). '. '. $ form-> model-> image-> getExtensionName (); $ form-> model-> image-> saveAs (Yii: app ()-> basePath. '/.. /upload /'. $ randName );......Articles you may be interested in
- Module Development and Analysis of Yii framework
- Summary of using database transactions in Yii
- Yii action Methods and Techniques
- How to store and rename files uploaded by fckeditor by date
- Detailed analysis on the directory structure of the yii framework
- Yii framework cache knowledge Summary
- Yii controller action parameter binding
- How to configure the default controller and action in the yii framework