File uploading

Hi guys. I’v got an issue and wanted to share it with you. I use Backendless.Files.upload() -Javascript SDK- to upload a file to the server. This method returne the “fileURL” and that is great. When I upload a file that has whitespaces in the name so the whitespaces were replaced with “+” in the “fileURL” returned by the method. But those whitespaces ware not replaced in the name of the file on the server. f.e. I upload “test file.pdf” to the server. Then I get the “fileURL” like this : “path/to/the/file/tes+file.pdf”. But when I chek on the server so the file still named as “test file.pdf”.

The issue is that I use that “fileURL” to save to a column with a type of “FILE REFERENCE”. This means that the “FILE REFERENCE” column will have a “path/to/the/file/test+file.pdf” as value. While the rial path to the file is “path/to/the/file/test file.pdf”. Thus I get an error when I try to download the file with error “The specified resource was not found”.
When I update the value of the column, manually, to “path/to/the/file/test file.pdf” so everything works fine.

I tried to use decodeURI() but got the same issue.

Hello,

I just tried the same scenario. Here’s what I have:

File in the file repo:

File is referenced in a data object through a FILE REFERENCE column:

API response when I fetch the object:

And here’s a link to the file - notice it has “+” instead of space AND the file opens in a browser just fine:
https://backendlessappcontent.com/DDA6CE4B-5AE3-B4BB-FF61-021A41EA4100/656DB5F1-1181-A1D2-FF87-54D17261A200/files/demofolder/test+file.txt

Regards,
Mark

Hi Mark. Thanks for replying. In our case there is no problem with retrieving the link with “+”. After a bit investigation I found out that the Backendless.Files.Permissions.READ.grantUse(id, path) API can not find the path if this path has “+”. In our app we need to give a permission to other users to be able to download the file. That why we use this API Backendless.Files.Permissions.READ.grantUse().

When I replaced all “+” with whitespace in the “path” before passing it to Backendless.Files.Permissions.READ.grantUse(id, path), the error disappeared and I could get the file downloaded.

Thank you for letting me know. I will close this topic as “solved” then.

Regards,
Mark