Commit 67d432ac06647437e7c19ebfbd60305888574885
1 parent
165348a4
final upload form wihtout file extension validation
Showing
7 changed files
with
12 additions
and
9 deletions
Show diff stats
backend/components/parsers/CsvParser.php
backend/components/parsers/Encoder.php
backend/components/parsers/MailParser.php
backend/components/parsers/ParserHandler.php
backend/components/parsers/ValueFilter.php
backend/models/UploadFileParsingForm.php
... | ... | @@ -3,7 +3,7 @@ namespace backend\models; |
3 | 3 | |
4 | 4 | use yii\base\Model; |
5 | 5 | use yii\web\UploadedFile; |
6 | -use backend\components\ParserHandler; | |
6 | +use backend\components\parsers\ParserHandler; | |
7 | 7 | use Yii; |
8 | 8 | use common\components\debug\CustomVarDamp; |
9 | 9 | |
... | ... | @@ -31,7 +31,7 @@ class UploadFileParsingForm extends Model |
31 | 31 | ['importer', 'required', 'message' => 'Не указан поставщик!' ], |
32 | 32 | ['file', 'required', 'message' => 'Не выбран файл!' ], |
33 | 33 | //@todo - not working this file validator!!! - fixed |
34 | - [['file'], 'file', 'extensions' => ['csv', 'xml'] ], //'extensions' => ['csv'], | |
34 | + [['file'], 'file'],// 'extensions' => ['csv', 'xml'] ], | |
35 | 35 | // 'wrongMimeType' => 'Указан неподдерживаемый тип файла. Можно выбирать csv, xml файлы.' ], |
36 | 36 | ['importer', 'integer','max' => 999999, 'min' => 0 ], |
37 | 37 | [['action','delete_prefix', 'delete_price'], 'boolean'], |
... | ... | @@ -51,7 +51,6 @@ class UploadFileParsingForm extends Model |
51 | 51 | } |
52 | 52 | |
53 | 53 | public function readFile($filePath){ |
54 | - CustomVarDamp::dumpAndDie( new ParserHandler( $filePath, $this )); | |
55 | 54 | $parser = new ParserHandler( $filePath, $this ); |
56 | 55 | $data = $parser->run(); |
57 | 56 | ... | ... |
backend/views/parser/index.php
... | ... | @@ -7,7 +7,11 @@ use yii\helpers\ArrayHelper; |
7 | 7 | ?> |
8 | 8 | <div class="row"> |
9 | 9 | <div class="col-lg-5"> |
10 | - <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data',],'action'=>['parser/results']]) ?> | |
10 | + <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data',],'action'=>['parser/results']]); | |
11 | + if (!$model->action) { | |
12 | + $model->action = 1; | |
13 | + } | |
14 | + ?> | |
11 | 15 | <h3>Загрузка прайсов поставщиков</h3> |
12 | 16 | |
13 | 17 | ... | ... |