Bra*_*don 3 node.js cloudinary
我在上传到正确的文件夹时遇到了一些困难。如果我指定:
cloudinary.uploader.upload(filePath, {
folder: 'test-directory'
});
Run Code Online (Sandbox Code Playgroud)
我正在关注节点集成指南:http : //cloudinary.com/documentation/image_upload_api_reference#upload
我提前创建了“测试目录”。图像上传成功,但总是进入我的媒体库的根目录。
我在我的帐户设置中启用了“自动创建文件夹”。
这是来自 Cloudinary 的示例上传响应:
{
public_id: 'we1yjvlpxc1qtuf1oaqe',
version: 1503236713,
signature: '37edbc2b19ea72b75298acce8075f9e8ddb12d09',
width: 675,
height: 37,
format: 'jpg',
resource_type: 'image',
created_at: '2017-08-20T13:45:13Z',
tags: [],
bytes: 602,
type: 'upload',
etag: 'b5522ae652340881b213c46c035d0aed',
url: 'http://res.cloudinary.com/alsoicode/image/upload/v1503236713/we1yjvlpxc1qtuf1oaqe.jpg',
secure_url: 'https://res.cloudinary.com/alsoicode/image/upload/v1503236713/we1yjvlpxc1qtuf1oaqe.jpg',
original_filename: 'test_r6_c1'
}
Run Code Online (Sandbox Code Playgroud)
我也尝试将文件夹名称添加到public_id选项中,但这也不起作用。
我究竟做错了什么?
小智 8
添加使v2上传参数的顺序为(文件、选项、回调)-
cloudinary.v2.uploader.upload(filePath, {
folder: 'test-directory',
use_filename: true
});
Run Code Online (Sandbox Code Playgroud)
没有它,订单是(文件,回调,选项)-
cloudinary.uploader.upload(filePath,function(res){console.log(res);},{
folder: 'test-directory',
use_filename: true
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2161 次 |
| 最近记录: |