官方文档入口:概述 | uniCloud (dcloud.net.cn)https://doc.dcloud.net.cn/uniCloud/storage/dev.html#clouduploadfile
问题描述
如何在cloudstorage下新建文件夹
解决方案
文档细节如下:
使用cloudPathRealPath可以指定绝对路径,这样在cloudPath中文件存储路径的某个文件不存在会被自动创建
下面是我上传的音频文件,上传时为每个当前用户都建立了一个以用户名作为的名字的文件夹
recordHandle.onStop((res) => {
uni.showLoading({
title: '上传中...'
})
const username = uni.getStorageSync('user_info').username
uniCloud.uploadFile({
cloudPathAsRealPath: true,
cloudPath: `cloudstorage/${username}/${new Date().getTime()}.acc`,
filePath: res.tempFilePath,