1

Ubuntuu - ssh - Symfony3 - Angular-seed - Dropzone

我正在处理一项任务,该任务将 excel 文件从 dropzone 上传到使用 symfony3 实现的 Web 服务。上传完成后,web-service 开始解析文件,以便为 dorpzone 的成功事件返回成功,它正在等待解析结果的 php-part 的信号。

我正处于部署阶段,正在使用我的客户端的 ssh-server。当我运行我的网络服务时,一切工作正常(上传、解析、返回成功消息)

php bin/控制台服务器:启动myserverurl:端口

但是当我使用客户端创建的虚拟主机时,现在出现了问题:

上传文件后,我立即收到了 dropzone 的错误“服务器以 0 代码响应。 ”但是该文件已被 web 服务获取并且该过程已成功完成,当然它尝试将成功的结束消息返回到 dropzone,但它已经下来了。我已经测试过这些大小(2.4M / 8.9M / 14.5M)的文件。

相反,一切都适用于某些文件(207K / 50K)。

我无法断定这个问题是否是由于外部参数(apache-limit,...),我不确定服务器是否因为时间限制或其他原因阻止了 dropzone 的等待事件。

这是我的 dropzone 配置:

$scope.dropzoneConfig = {
            'options': { // passed into the Dropzone constructor
                'url': $rootScope.baseUrl + 'admin/surveys/updates?access_token=' + $auth.getToken(),
                'maxFiles': 1,
                'uploadMultiple': false,
                'autoProcessQueue': false,
                'maxFileSize': 30
            },
            'eventHandlers': {
                'addedfile': function (file) {
                    if (!$scope.dropzone) {
                        $scope.dropzone = this;
                    }

                    if (!(vm.allowedExt.indexOf(vm.getFileExt(file.name)) > -1 )) {
                        $scope.resetForm();
                        vm.showErrorAlert('L\'extension de votre fichier est invalide , SVP veuilez choisir une extension .xlsx ou .xls');
                        return;
                    }

                    if ($scope.surveyCreate) {
                        if ($scope.surveyCreate.$valid) {
                            vm.enableBtn();
                        } else {
                            vm.disableBtn();
                        }
                    }

                    // survey edit
                    if ($scope.surveyEdit && $scope.selectedSurvey != undefined) {
                        vm.enableBtn();
                    }

                },
                'maxfilesexceeded': function (file) {
                    this.removeAllFiles();
                    this.addFile(file);
                },
                'sending': function (file, xhr, formData) {
                    if ($scope.survey != undefined && $scope.survey.name) {
                        formData.append('name', $scope.survey.name);
                    }

                    if ($scope.selectedSurvey != undefined) {
                        formData.append('survey_id', $scope.selectedSurvey.id);
                    }
                },
                'success': function (file, response) {
                    vm.hideSpinner();
                    $scope.resetForm();
                    if (response.success) {
                        vm.showSuccessAlert();
                        $scope.updateSurveysArray(response.data);
                    } else {
                        vm.showErrorAlert(response.errorMsg);
                    }
                },
                "error": function (file, error, xhr) {
                    vm.hideSpinner();
                    $scope.resetForm();
                    if (error.hasOwnProperty('message'))
                        vm.showErrorAlert(error.message);
                    else
                        vm.showErrorAlert('file transfer error');
                }
            }
        };

有任何想法吗 ?

4

1 回答 1

1

首先检查 php.ini 并检查 upload_max_filesize 是否小于 1000M

在提交按钮上添加事件监听器:

submitButton.addEventListener("点击", function (file) {

    if (myDropzone.getAcceptedFiles().length > 0) {
        if (submitfiles === true) {
            submitfiles = false;
            return;
        }

        file.preventDefault();
        myDropzone.processQueue();

        myDropzone.on("complete", function () {
            submitfiles = true;
            $('#submit_button').trigger('click');
        });
    } 
});
于 2017-03-30T11:17:36.073 回答