I have just find out that my application is having a QA problem. The user can import pdf or jpeg file using file picker. During this operation, I am collecting the filename so it can be displayed in a Text widget on a card. Then, the user is saving his modifications. The file is then uploaded to Storage. This works fine, and the name for example "user guide.pdf" is recorded properly in Storage. When the upload if finished, I am collecting the url to I can store it into an array in FireBase. This is where I am having an issue. The url when it is recorded in FireBase, does not match the original name. it is now "user guide.pdf". This is causing a problem to my application. I have done some research, but I do not find how to stop this behaving. Please, can you point me to the right direction? Many thanks
for (int g = 0; g < List_Adding_New_Attachements.length; g ) {
final fileName = List_Adding_New_Attachements[g]
.split('/')
.last;
final destination = fileName;
attachment_Files = FirebaseApi_Upload_Files_To_Storage.uploadFile(
destination, List_Adding_New_Attachements[g]);
setState(() {});
if (attachment_Files == null) return;
CodePudding user response:
I also had the same issue and I was able to make it work by using decodeComponent()
method from URI.
So what you could do is wherever you check for your file name, add this to your code:
Uri.decodeComponent("user guide.pdf") // user guide.pdf
More information related to Uri.decodeComponent
can be found here!