I want to upload a video file to my cloud storage but I want to check the size of the video file before I upload. how to achieve this
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If you have the path of the file, you can use dart:io
var file = File('the_path_to_the_video.mp4');
You an either use:
print(file.lengthSync());
or
print (await file.length());
Note: The size returned is in bytes
.