shorif2000
shorif2000

Reputation: 2654

rename button on yii FileUpload

I am using Yii file upload and want to rename the button from Browse to something else. how do i do this?

model

<?php 
class Fileupload extends CFormModel
{


    public $jobs;
    // ... other attributes

    public function rules()
    {
        return array(

            array('jobs', 
                    'file', 
                    'types'=>'csv, xls, xlsx'
            ),
        );
    }

    public function attributeLabels()
    {
        return array(
                'jobs' => 'Uploaded file',
        );
    }
}

view

echo CHtml::activeFileField(new Fileupload,'jobs', array('onChange'=>'showLoadDialog();submit(this)',"name"=>"Upload"));

the html output i get is

<input id="ytUpload" type="hidden" name="Upload" value="">
<input id="Upload" type="file" name="Upload" onchange="showLoadDialog();submit(this)">

Upvotes: 1

Views: 1114

Answers (1)

osmancode
osmancode

Reputation: 291

you can't control file upload style or label by editing the html

You need something a bit advanced like using javascript uploader.

i suggest this one: http://jasny.github.io/bootstrap/javascript/#fileinput

Upvotes: 1

Related Questions