Hello everyone,
Currently I am trying to get the selected file name but failed.
Here is how I am doing and I will point out the current situation.
The process is like below.
click button -> select multiple files locally (=don't upload at this moment)-> use custom function to get the files' name -> show the names
The custom function is as below:
List<dynamic>? getFilesname(List<FFUploadedFile>? uploadedLocalFiles) {
/// MODIFY CODE ONLY BELOW THIS LINE
// Return the files' name in a string list by the given uploadedLocalFiles.
if (uploadedLocalFiles == null || uploadedLocalFiles.isEmpty) {
return null;
}
List<List<dynamic>> fileNames = [];
for (FFUploadedFile file in uploadedLocalFiles) {
String fileName = file.name.toString();
String fileType = file.name.toString().split('.').last;
fileNames.add([fileName, fileType]);
}
return fileNames;
/// MODIFY CODE ONLY ABOVE THIS LINE
}
Currently I am able to get the files' name BUT they are not the original name of the selected files.
For example, if I upload A.pdf, B.png, C.jpeg, what I got will be something like:
-169415713644000_0.pdf
-169415713644000_1.png
-169415713644000_2.jpeg
* The number before underscore changes every time.
Is there any way to get the original file name (A.pdf, B.png, C.jpeg)?