How can we choose file from local system drives in Flutter web development . Not in App Please any one suggest me .
I am using like this I can able to choose file But how can i get the file path
How can we choose file from local system drives in Flutter web development . Not in App Please any one suggest me .
I am using like this I can able to choose file But how can i get the file path
You need to get the data and create a MediaInfo class for it
class MediaInfo{
String fileName;
String filePath;
}
Get File Path
Future<MediaInfo> convertFileGetNamePath({@required html.File file}) async {
final Map<String, dynamic> infoData = {};
final reader = html.FileReader();
reader.readAsDataUrl(file);
await reader.onLoad.first;
final fileName = file.name;
infoData.addAll({
'name': fileName,
'path': filePath,
});
MediaInfo webImageInfo = MediaInfo();
webImageInfo.fileName = infoData['name'];
webImageInfo.filePath = infoData['path'];
return webImageInfo;
}
Implement it in your code
MediaInfo getInfo = await convertFileGetNamePath(file: imageFile);
fileName = getInfo.fileName;