首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >下拉区域-服务器响应为0代码

下拉区域-服务器响应为0代码
EN

Stack Overflow用户
提问于 2017-03-29 11:13:23
回答 1查看 4.3K关注 0票数 1

Ubuntuu Symfony3 -角种子- Dropzone

我正在做一项任务,将excel文件从下拉区域上传到用symfony3实现的web服务。上传完成后,web服务开始解析文件,以返回dorpzone成功事件的成功,该事件正在等待php(解析结果的一部分)的信号。

我正处于部署阶段,正在使用我的客户端的ssh服务器。当我运行我的web服务时,每件事情都很正常(上传、解析、返回成功消息)。

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

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

上传文件后,我立即得到下拉区域的错误“服务器响应了0代码.”,但是该文件已经由web服务获得,并且进程已经成功完成,当然它试图将成功的结束消息返回到下拉区域,但是它已经关闭了。我已经测试过那些大小的文件(2.4M / 8.9M / 14.5M)。

相反,所有东西都与某个文件(207 K/ 50K)很好地工作。

如果这个问题是由于外部参数(apache,.)造成的,我不确定服务器是否因为时间限制或其他原因阻止了下拉区域的等待事件。

这是我的下拉区域配置:

代码语言:javascript
复制
$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');
                }
            }
        };

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2017-03-30 11:17:36

首先检查php.ini,如果它小于1000米,则检查为upload_max_filesize。

在submit按钮上添加事件侦听器:

SubmitButton.addEventListener(“单击”,函数(文件){

代码语言:javascript
复制
    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');
        });
    } 
});
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43091941

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档