Hi,
i am using activefileField in add more…for image upload.
code is :book_no and book_photo
<td><?php echo CHtml::activeTextField($book_trans,"book_no[]",array('size'=>10)); ?></td>
<td><?php echo CHtml::activefileField($book_trans,"book_photo[]",array('size'=>10)); ?></td>
it works successfully in add more ,create successfully, but when i am updating my form at that time it will not display the path of image that i have selected at the time of creation…
in update code i ve write this code for update.
<?php foreach($book_tran_data as $i=>$item): ?>
<tr class='test'>
<td><?php echo CHtml::activeTextField($item,"book_no[$i]",array('size'=>10,'value'=>$item->book_no));?></td>
<td><?php echo CHtml::activefileField($item,"book_photo[$i]",array('size'=>10,'value'=>$item->book_photo)); ?></td>
but it will not display me a path…
please suggest me…
Thanks in Advance,
Regards,
janvi
joblo
(Joe)
June 14, 2014, 2:18pm
2
The path (= file-tag attribute ‘value’) never will be displayed in html because of security.
You have to add the current value (as label) by yourself:
echo CHtml::activefileField($model,'fileattr') . ' ' .$model->fileattr;
Joblo:
The path (= file-tag attribute ‘value’) never will be displayed in html because of security.
You have to add the current value (as label) by yourself:
echo CHtml::activefileField($model,'fileattr') . ' ' .$model->fileattr;
Hi,
Can you please elaborate your solution… exactly i am not getting what u r saying.
i ve use echo CHtml::activefileField($model,‘fileattr’) . ’ ’ .$model->fileattr; in my code as
echo CHtml::activefileField($item,“book_photo[$i]”) . ’ ’ .$item->book_photo;?>
it shows me random number : 10256965_893268024036177_292737636694107193_n.jpg
Thanks,
Regards,
Janvi
Joblo:
The path (= file-tag attribute ‘value’) never will be displayed in html because of security.
You have to add the current value (as label) by yourself:
echo CHtml::activefileField($model,'fileattr') . ' ' .$model->fileattr;
Hi Joblo Sir,
Thanks its works properly…
Thank u so much for guidance.
Regards,
Janvi