2

I used widget in my web application to upload files. In my view file, I used following widget code:

<?= $this->widget('application.components.FileUploadWidget',array(
                'model'=>$model,
                'attribute'=>'f_5',
                'htmlOptions'=>array('class'=>'form-control')
            ),true) ?>

I could not retrieve name of the uploaded file.How can I get the name of the uploaded file from the widget?(For example, if I upload file called image.jpg, I will be able to get image.jpg name itself )

phpdev
  • 511
  • 4
  • 22

1 Answers1

0

Try to print this

public function actionUpload()
{
    $model= new YourModel();
    if(isset($_POST['YourModel']))
    {
        $image = CUploadedFile::getInstancesByName('f_5');

    echo "<pre>";print_r($image);
    }
Passionate Coder
  • 7,154
  • 2
  • 19
  • 44