public function actionUploadFu2()
 {
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $type = Yii::$app->request->get('type', '1_L');
     $template_id = Yii::$app->request->get('id', '');
     $template = Template::findOne(['id' => $template_id]);
     if (!$template) {
         return ['error' => ['msg' => Yii::t('app', 'Шаблон не найден')]];
     }
     $model = new DynamicModel();
     //$model->formName();
     $file = UploadedFile::getInstance($model, 'fu2');
     if (!$file) {
         return ['error' => ['msg' => Yii::t('app', 'Файл не получен')]];
     }
     if ($file->size <= 0) {
         return ['error' => ['msg' => Yii::t('app', 'Файл пустой')]];
     }
     $fu2_path = UserUrl::fu2(false, $template_id, $type);
     $file->saveAs($fu2_path);
     return ['response' => ['status' => true, 'type' => $type]];
 }
Beispiel #2
0
                                </a>
                            </form>

                            <br/>


                            <form action="<?php 
echo Url::toRoute(['template-api/upload-fu2', 'id' => $template->id, 'type' => '1_R']);
?>
" enctype="multipart/form-data">
                                <a class="btn btn-primary button-1-line fileinput-button btnUpload1R ladda-button" data-style="zoom-in" data-spinner-color="#993149">
                                    <!--<i class="glyphicon glyphicon-plus"></i>-->
                                    <div class="button-col button-icon ">
                                        <?php 
if (file_exists(UserUrl::fu2(false, $template->id, '1_R'))) {
    ?>
                                            <i class="fa fa-check"></i>
                                        <?php 
} else {
    ?>

                                            <i class="fa fa-remove"></i>
                                        <?php 
}
?>
                                    </div>
                                    <div class="button-col" >
                                        <?php 
echo Yii::t('app', '1_R');
?>