Hi all,
i m not understanding how should i carry on to Preview an image before it is being saved to database in yii using jquery or any method that you can suggest
[code]
view
<img src="images/<?php echo $model->pimg; ?>" width="150px" height="120px"/>
<?php echo $form->labelEx($model,'pimg'); ?>
<?php echo $form->fileField($model, 'pimg'); ?>
<?php echo $form->error($model,'pimg'); ?>
[code]
the jquery code
[code]
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imgInp").change(function(){
readURL(this);
});
[code]
how should i integrate this jquery function in abv form … $form has the htmlOptions
PLEASE HELP! I am new to Yii and am loosing my mind on this. Thank you.