Closed RoyiNamir closed 6 years ago
Hi @RoyiNamir,
I reviewed your case and found that your case might be related to the path, which you have provided for the file inside the upload method. Regarding that I would suggest moving the raw folder inside te application root folder
Edit:
and to get the path to the file while using file-system
module. With its help, you could access the current app folder path. I am attaching sample project
Archive 2.zip
@tsonevn - why cant i use raw or assets folders like in normal android app? Which is under app resources folder. I just want to know for future developing 🤗
@tsonevn your demo is not uploadng the mp3 but an image - which is not in the raw folder.
and you access it via documents.path. can you fix it to use the raw folder ? ( becuase it still doesn't find the file)
HI @RoyiNamir, Excuse me for the inconvenience, I updated my previous comment. I reviewed the plugin implementation and at this time the correct way is to access a file from the project via file-system modules.
@tsonevn Thanks. so this leaves me only with fs.knownFolders.documents()
, right ?
Because According to the docs - https://docs.nativescript.org/cookbook/file-system
Hi @RoyiNamir ,
yes, while using the current version of the nativescript-background-http
plugin the file path could be accessed with the help of File-System
module.
This module allows you to access documents folder, current app folder, and the app Temporary (Caches) folder. More about the methods provided by the file system could be found here.
I have an
mp3
file which I want to upload.So this is the hierarchy :
And this is how I call it :
But I get an error :
JS: ERROR Error: java.io.FileNotFoundException: Could not find file at path: /raw/a1.mp3
Question:
Should my mp3 file ( beep sound) be at
raw
at first place ? and if so - how can I usesession.uploadFile(..)
with the right path ?