[英]Unable to upload audio to the server
I am able to upload audio locally. 我可以在本地上传音频。 But uploading audio to the server is not working.
但是无法将音频上传到服务器。 My code is:
我的代码是:
module.exports.uploadAudio = function (req, res) {
var form = new multiparty.Form();
form.parse(req, function (err, fields, files) {
console.log("Audio_Path=======>>>> " + JSON.stringify(files.file[0].path));
cloudinary.uploader.upload(files.file[0].path, function (result) {
console.log(result);
obj.key2 = result.url;
res.send({
result: result,
serverStatus: 200,
response_message: "audio uploaded"
});
}, {
resource_type: "auto"
})
})
}
Try to use "video" instead of "auto" for the value of the property "resource_type": 尝试使用“视频”代替“自动”作为属性“ resource_type”的值:
cloudinary.uploader.upload(files.file[0].path, function (result) {
console.log(result);
obj.key2 = result.url;
res.send({
result: result,
serverStatus: 200,
response_message: "audio uploaded"
});
}, {
resource_type: "video"
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.