Reading all files from a directory on server

Hi!

I’m trying to read textures from a database using: this.app.assets.loadFromUrl();
However, the path I have to insert is a path directly to the .jpg, and I want to loop through multiple files inside one directory without knowing the full path, just the directory.

Is there a way to find the names of all the assets inside a directory? (Directory outside Playcanvas)

Thanks in advance!

Hi @Slappy_Inc,

To do that you need to either have a Rest API call provided by the server which you can call and as a reply get a list of all paths.

Normally most servers for security reasons don’t allow access to folders. Potentially if you control the server you can ask the server admin to enable that feature, or have him create a Rest call instead.

There isn’t any other way.