Home >PHP Framework >YII >How to upload files in yii?

How to upload files in yii?

coldplay.xixi
coldplay.xixiOriginal
2020-07-21 16:14:013084browse

yii method of uploading files: first create an [UploadImageForm.php] file in the models folder; then find the SiteController controller and create a view file; finally output html and allow users to select and upload files That’s it.

How to upload files in yii?

yii method of uploading files:

1. Create an UploadImageForm in the models folder. php File method codeHow to upload files in yii?

2. Implementation of adding actionLoadImage() method to SiteController controller method code

How to upload files in yii?

3. Implementation Create a view file upload.php file method code in the views/site directory

How to upload files in yii?

##4. Implement the fileInput() method and output the following HTML method code as follows

How to upload files in yii?

5. The test effect of allowing users to select and upload files is as follows

How to upload files in yii?

6. Click: Submit button to save the file on the server The data in the uploads folder is as follows

How to upload files in yii?

Related learning recommendations:

yii tutorial

The above is the detailed content of How to upload files in yii?. For more information, please follow other related articles on the PHP Chinese website!

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