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,.)造成的,我不确定服务器是否因为时间限制或其他原因阻止了下拉区域的等待事件。
这是我的下拉区域配置:
$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');
}
}
};有什么想法吗?
发布于 2017-03-30 11:17:36
首先检查php.ini,如果它小于1000米,则检查为upload_max_filesize。
在submit按钮上添加事件侦听器:
SubmitButton.addEventListener(“单击”,函数(文件){
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');
});
}
});https://stackoverflow.com/questions/43091941
复制相似问题