How to display an image instead of the file field in yii

advertisements

In yii i have a echo CHtml::activeFileField($model, 'image'); . it displays the usual <input type="field ... DOM object . how can i display an image instead of the file input field . so when clicked the user can choose a file ?

is there a way to do it via yii ? or jquery in yii ? Thank you


You can do it very easy via css: input[type="file"]{opacity:0;} and the label next to it have an image background witch you can position absolute over it. Be sure to have set an width and height for your input so it not exceeds your label size