Problem with CHtml::activeFileField

Hi all,

I am using CHtml::activeFileField as -


And $model is an object of model DefaultConfiguration having field name Logo.

But I am not able to upload file. 

I saw my view source and it is like -   

<input id="ytLogo" type="hidden" value="" name="Logo" />

    <input name="Logo" id="Logo" type="file" /> 

 I just looked at the name of the file field  and it is logo instead of DefaultConfiguration[Logo]

 So it is not coming into my _POST[DefaultConfiguration] array.

Please help me?

Thanks in adv.

First, set form’s attribute entype=“multipart/form-data”.

Second, files are stored in the global $_FILES array.

To validate a file you have to create a CUploadedFile instance:

Hi andy_s,

Thanks for your reply!

   I added enctype=&quot;multipart/form-data&quot; into my form attribute and it worked like charm

Thanks again!