【发布时间】:2017-03-29 11:13:23
【问题描述】:
Ubuntuu - ssh - Symfony3 - Angular-seed - Dropzone
我正在执行一项任务,该任务将 excel 文件从 dropzone 上传到使用 symfony3 实现的 Web 服务。 上传完成后,web-service开始解析文件,为dorpzone的成功事件返回成功,等待解析结果的php部分的信号。
我正处于部署阶段,正在使用我的客户端的 ssh 服务器。 当我使用
运行我的网络服务时,一切工作正常(上传、解析、返回成功消息)php bin/控制台服务器:启动 myserverurl:port
但是当我使用客户端创建的虚拟主机时,现在出现了问题:
上传文件后,我立即收到了 dropzone 的错误“服务器响应为 0 代码。”但该文件已被网络服务获取并且进程是成功完成,当然它尝试将成功的结束消息返回到 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');
}
}
};
有什么想法吗?
【问题讨论】:
-
你解决过这个问题吗?我也随机遇到了同样的问题,但不知何故只有 IOS 客户端。如果我尝试在从先前的 ajax 上传收到响应之前附加一个新文件,则先前的请求将出错(即使我的服务器处理该请求很好)。 Apache 日志显示 200 成功响应。 Nginx 虽然显示 499,但让我认为 IOS 客户端(使用 Safari 和 Chrome 测试)只是在收到响应之前关闭了连接。
标签: ssh apache2 dropzone.js symfony-3.1 angular-seed