我想通过PHP和进度条从前台上传文件到远程服务器,我该怎么做?是否可以不在前端和远程服务器上安装额外的软件?
在前端服务器a上有apache,在远程服务器a上有PHP,在nginx上有PHP-FPM
发布于 2018-07-11 19:44:52
you can view this question in details。无论如何,当您从query调用ajax request时,其中有一个名为uploadProgress的函数,您可以调用并跟踪服务器中文件上传的状态和百分比。此函数接受四个参数event, position, total, percentComplete
示例
$.ajax({
beforeSend: function() {
// reset your progress bar here or do anything before making a call to endpoint
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
$('#progressBar').width(percentVal);
},
complete: function(xhr) {
alert(xhr.responseText);
}
});https://stackoverflow.com/questions/51275318
复制相似问题