file and unigue field

I have a field of a table that has the name of a file that I upload and it must be also unique as name.

I want to ask if these rules are ok together.


public function rules()

    {

        return [

           ...

            [

            [['file'], 'file', 'skipOnEmpty' => TRUE, 'extensions' => 'png, jpg,pdf,doc,docx,xls,xlsx,gif,txt'],

           [['file'],  'unique'],

          

        ];

    }

it should work syntax looks okay to me there is an extra bracket though