1.test.php
Copy code The code is as follows:
'/test/upload/'Change it to your corresponding address.
2.TestController.php
Copy code The code is as follows:
public function actionUpload( )
{
$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
$image = CUploadedFile::getInstanceByName('file' ; {
mkdir($dir); 🎜>
$status = $image->saveAs($name,true);
//Save the file
if ($status) {
echo 'success';
}else {
echo 'fail';
Visit http://www.ttlsa.com/test/test and upload your files. If successes appears, it means success.
http://www.bkjia.com/PHPjc/748159.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/748159.htmlTechArticle
1.test.php Copy the code as follows: body form action="?php echo $this-createUrl(' /test/upload/');?" method="post" enctype="multipart/form-data" input type="file" name="file"/ inp...