0

I want to show path of already uploaded file which is stored in DB. How can i show this path instead of default message "no file selected".

enter image description here

I had a textField where path wos loaded at update action. Now i've changed textField to fileFiled but i wish users could see the path of already uploaded file.

enter image description here

Can i add something to fileField $htmlOptions to show this path?

<div class="control-group">
    <?= $form->labelEx($model, 'path_to_logo', array('class' => 'control-label')); ?>
    <div class="controls">
        <?= $form->fileField($model, 'path_to_logo', array('class' => 'span12')); ?>
        <?= $form->error($model, 'path_to_logo'); ?>
    </div>
</div>

UPDATE: I wish to have this effect when path to file already exists: enter image description here

TomLi
  • 123
  • 12

1 Answers1

1

It is not possible to set file field value due to security reasons. See How to set a value to a file input in HTML?

If you want to display current path you should output it separately is a <span or other HTML element.

Sam Dark
  • 5,291
  • 1
  • 34
  • 52