获取从 NodeJS 上传到 Cloudinary 的图片路径
Get image paths uploaded to Cloudinary from NodeJS
我可以通过如下遍历数组来正确地将图像上传到 Cloudinary:
const imagesToCloudinary = req.files.map ( data => {
cloudinary.v2.uploader.upload(data.path)
});
let imageResponses = await Promise.all(imagesToCloudinary);
console.log(imageResponses);
但是在控制台中我从来没有得到任何信息,在这种情况下我需要路由。
控制台响应:
[ undefined, undefined, undefined ]
const imagesToCloudinary = req.files.map ( data => {
// missing return statement
return cloudinary.v2.uploader.upload(data.path)
});
let imageResponses = await Promise.all(imagesToCloudinary);
console.log(imageResponses);
我可以通过如下遍历数组来正确地将图像上传到 Cloudinary:
const imagesToCloudinary = req.files.map ( data => {
cloudinary.v2.uploader.upload(data.path)
});
let imageResponses = await Promise.all(imagesToCloudinary);
console.log(imageResponses);
但是在控制台中我从来没有得到任何信息,在这种情况下我需要路由。
控制台响应:
[ undefined, undefined, undefined ]
const imagesToCloudinary = req.files.map ( data => {
// missing return statement
return cloudinary.v2.uploader.upload(data.path)
});
let imageResponses = await Promise.all(imagesToCloudinary);
console.log(imageResponses);