相关平台
React Native
使用框架: React
复现步骤
Taro.uploadFile({
url,
filePath,
success (res) {
console.log(JSON.stringify(res))
}
})
期望结果
{
"filePath": "file:///storage/emuLated/0/Android/data/com.yonyougov.cwy/fiLes/Pictures/IMG_CMP-F9D31AD8E65383238348B177FB8F71.jpeg ",
"name": "file",
"url": "/abf/app/attachment/upLoadFiLes"
}
实际结果
{
"type": "default",
"status": 200,
"ok": "true",
"statusText": "",
"urt": "...",
"bodyUsed": "false",
"_bodyInit": {
}
}
环境信息
👽 Taro v3.3.11
Taro CLI 3.3.11 environment info:
System:
OS: macOS 11.6
Shell: 5.8 - /bin/zsh
Binaries:
Node: 15.12.0 - /usr/local/bin/node
Yarn: 1.22.10 - ~/.nvm/versions/node/v15.12.0/bin/yarn
npm: 7.6.3 - ~/.nvm/versions/node/v15.12.0/bin/npm
npmPackages:
@tarojs/cli: 3.3.12 => 3.3.12
@tarojs/components: 3.3.12 => 3.3.12
@tarojs/mini-runner: 3.3.12 => 3.3.12
@tarojs/react: 3.3.12 => 3.3.12
@tarojs/runtime: 3.3.12 => 3.3.12
@tarojs/taro: 3.3.12 => 3.3.12
@tarojs/webpack-runner: 3.3.12 => 3.3.12
babel-preset-taro: 3.3.12 => 3.3.12
eslint-config-taro: 3.3.12 => 3.3.12
react: ^17.0.2 => 17.0.2
react-native: ^0.66.1 => 0.66.1
npmGlobalPackages:
typescript: 4.2.3
2条答案
按热度按时间x8diyxa71#
临时解决方案
5ssjco0h2#
success回调参数中,没有data字段