Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 在上载到Firebase存储之前,您必须知道图像文件类型吗?_Image_Flutter_Firebase Storage - Fatal编程技术网

Image 在上载到Firebase存储之前,您必须知道图像文件类型吗?

Image 在上载到Firebase存储之前,您必须知道图像文件类型吗?,image,flutter,firebase-storage,Image,Flutter,Firebase Storage,将用户从设备检索的图像文件添加到firebase云存储时,是否可以将.jpg、.png或.webp附加到文件名 比如说, storageReference.child('images/example.jpg').putFile(file) 或 我过去一直这样做,没有任何问题,但感觉不对。 我是否必须检索文件类型并添加适当的扩展名 我希望firebase存储中的所有图像都具有相同的文件扩展名,但我不确定从中获取不同的文件类型并添加统一的扩展名是否是保存图像的正确方法 创建颤振应用程序…无需指定类

将用户从设备检索的图像文件添加到firebase云存储时,是否可以将
.jpg
.png
.webp
附加到文件名

比如说,

storageReference.child('images/example.jpg').putFile(file)

我过去一直这样做,没有任何问题,但感觉不对。 我是否必须检索文件类型并添加适当的扩展名

我希望firebase存储中的所有图像都具有相同的文件扩展名,但我不确定从中获取不同的文件类型并添加统一的扩展名是否是保存图像的正确方法


创建颤振应用程序…

无需指定类型。如果指定一个以.png或.jpg结尾的特定文件,firebase存储将覆盖自动检测的类型。请查看firebase存储文档。它会更深入,但最基本的答案是,如果您指定文件类型,firebase存储将更新初始自动检测类型

storageReference.child('images/example.png').putFile(file)