我正在使用jquery_form将文件上传到快递服务器,它可以工作。但没有进度条。所以请帮助添加进度条。我相信很多人也需要这个。
所以这是代码
客户方:
$('#uploadvideoform').ajaxSubmit({
error:function(xhr){
alert(xhr);
},
success:function(response){
var videopath = response.path;
var videoview = "<video width='320' height='240' controls='controls'>";
videoview += "<source src="+videopath+" type='video/mp4' />";
videoview += "Your browser does not support the video tag.";
videoview += "</video>";
$('#view_product_video_content').append(videoview);
},
})
return false;
服务器端:
exports.upload = function(req, res){
var serverPath = 'Temp\\' + req.files.productvideo.name;
// console.log('req.files.productvideo.path '+req.files.productvideo.path)
// console.log('F:\\unit2\\'+serverPath);
require('fs').rename(
req.files.productvideo.path,
'F:\\unit2\\'+serverPath,
function(error){
if(error){
console.log(error)
return;
}
res.send({
path:serverPath,
});
});
};