Folder location problem?


I’m using nativescript-background-http and I have an mp3 file which I want to upload.

So this is the hierarchy :

And this is how I call it :

        var request = {
            url:         "http://localhost:8080/",
            method:      "POST",
            headers:     {
                "Content-Type": "application/octet-stream",
                "File-Name":    "bigpig.jpg"
            description: "{ 'uploading': 'bigpig.jpg' }"
        var task = session.uploadFile("/raw/a1.mp3", request);

But I get an error :

JS: ERROR Error: Could not find file at path: /raw/a1.mp3


Should my mp3 file ( beep sound) be at raw at first place ? and if so - how can I use session.uploadFile(..) with the right path ?


Did you try res://a1 @Royi_Namir

Edit: removed file extension
@sean-perkins is right



  • Does res:// referes to raw ??? I don’t understand. the file is an mp3. not image.
  • ( and what about assets folder ?)
  • where an mp3 should be at first place ? this is a sound for the app,


As mentioned by @multishiv19 anything inside App_Resources needs to be referenced from res://. For instance: res://raw/a1. You typically do not need to specify the extension, at least I’ve found that for images.

Nativescript and resources folder - is there a simple solution?

@sean-perkins well - there is a problem :

I’m trying to upload a file : (via nativescript-background-http)

File url : this.fileURL = "res://raw/a1"; //i’ve also tried a1.mp3


With this code :

  var request = {
            url:         "",
            method:      "POST",
            headers:     {
                "Content-Type": "application/octet-stream",
                "File-Name":    "bigpig.jpg"
            description: "{ 'uploading': 'bigpig.jpg' }"
        var task = session.uploadFile( this.fileURL, request);

But then I see

JS: ERROR Error: Could not find file at path: res://raw/a1
JS: net.gotev.uploadservice.UploadFile.(
JS: net.gotev.uploadservice.BinaryUploadRequest.setFileToUpload(


You could try manually finding the file through the file-system package.

For downloading files, I know I had to reference the file location like file://path_to_file.


@sean-perkins So now I’m confused.
When should I use knownFolders.documents().path+...myffile VS file://...myffile ? please(!) put some clarification in my mind :slight_smile:


file:// behaves the same as if you were to put file:// in your browser and press enter. It’s a shortcut accessor to the base-level file-system path. Now I don’t know if knownFolders.documents() is the same as file or not. I would assume documents is a level deeper.

Your error is 100% tied to not finding the file, so if you figure which path is valid, you’ll be moving forward.