Yii gets the suffix name of the uploaded file
Yii gets the suffix name 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);
......
Copy after login
Articles you may be interested in
- Yii framework module development analysis
- Summary of how to use database transactions in Yii
- Yii Action method skills
- How to store and rename uploaded files by date in fckeditor uploaded files
- Detailed analysis and explanation of yii framework directory structure
- Yii framework cache knowledge summary
- Yii controller action parameter binding processing
- How to configure the default controller and action in the yii framework
http://www.bkjia.com/PHPjc/1024332.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1024332.htmlTechArticleYii gets the suffix name of the uploaded file Yii gets the suffix name of the uploaded file, mainly using getExtensionName( in the CUploadedFile class ) method, for example: ?php...$form-image=CUploadedFile::ge...