UploadFileParsingForm.php
910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace backend\models;
use yii\base\Model;
use yii\web\UploadedFile;
use Yii;
/**
* UploadForm is the model behind the upload form.
*/
class UploadFileParsingForm extends Model
{
/**
* @var UploadedFile file attribute
*/
public $file;
public $first_line;
public $first_column;
/**
* @return array the validation rules.
*/
public function rules()
{
return [
[['file'], 'file'], //'extensions' => ['csv', 'xml'] ],
['first_line', 'integer'],
['first_column', 'integer']
];
}
public function attributeLabels()
{
return [
'file' => Yii::t('app', 'Источник'),
'first_line' => Yii::t('app', 'Первая значимая строка'),
'first_column' => Yii::t('app', 'Первый значимый столбец'),
];
}
}