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);
......
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...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn