拖放区 - 服务器以 0 代码响应



Ubuntuu - ssh - Symfony3 - 角状种子 - 空投区

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

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

PHP bin/console 服务器:启动myserverurl:port

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

更新文件后,我立即收到 dropzone 的错误">服务器响应 0 代码">,但该文件已被 Web 服务获取并且该过程已成功完成,当然它试图将成功的结束消息返回到 dropzone,但它已经关闭了。 我已经测试了这些大小(2.4M/8.9M/14.5M)的文件。

相反,对于某些文件(207K/50K),一切都运行良好。

我无法得出结论,如果这个问题是由于 extern 参数(apache-limit,...),我不确定服务器是否因为时间限制或其他原因而阻止了 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');
}
}
};

有什么想法吗?

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

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

submitButton.addEventListener("click", 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');
});
} 
});

最新更新