flutter - 400 错误:BadRequest - 从 Flutter 桌面发送到 Firebase 本地存储模拟器的 HTTP 请求
问题描述
我尝试从颤振桌面软件将图像上传到 Firebase 本地存储模拟器。我正在使用file_selector_windows插件进行文件选择。
void _openImageFile() async {
final typeGroup = XTypeGroup(
label: 'images',
extensions: ['jpg', 'png'],
);
final files = await FileSelectorPlatform.instance
.openFiles(acceptedTypeGroups: [typeGroup]);
final file = files[0];
final fileName = file.name;
final filePath = file.path;
final responseFireStorage = await http.post(
Uri.parse('http://localhost:9199/v0/b/default-bucket/o?name=sample.jpg'),
headers: <String, String>{
'Content-Type': 'image/jpeg',
},
body: filePath,
);
print(responseFireStorage.statusCode);
}
错误:400 错误请求
解决方案
推荐阅读
- java - 我完成了在作业所需位置找到字符的部分,但是如何从我找到的字符串中删除字符?
- android - Android Studio 生成签名的 apk 问题
- javascript - Discord.js avatarURL 的问题
- java - 如何在 OnReceive(广播下)类中制作自定义吐司?
- jvm - 尝试更改 java 选项后,GraphDB 无法创建 JVM
- object-detection - 为什么COCO用AP、AR按size来评价?AR max =1、10、100是什么意思
- rest - 部署在heroku中的spring boot rest api会引发应用程序超时错误,错误代码为h10
- ruby-on-rails - 如何在 Heroku 中设置内存使用警报?
- kotlin - 如何在 Kotlin 中覆盖 HashMaps entrySet 方法?
- android - 为什么在 Android N 上调用 ACTION_MEDIA_SCANNER_SCAN_FILE 时不会发生 FileUriExposedException