Hi, people of Babylon, I’ve faced some issues when I try to read and import to my scene using Append
This works fine.
let url= “https://myhost.com/model.gltf”
BABYLON.SceneLoader.Append(“”, url, scene, function (scene) {
// do something with the scene
});
However, when I get input from the form on my site it seems doesn’t work like that. I also tried using blob and dataurl but still no luck.
<input>Upload your files</input>
...
userInput.onchange = function(event) {
var fileList = inputElement.files;
BABYLON.SceneLoader.Append("", fileList[0], scene, function (scene) {
// do something with the scene
});
}
That array looks a bit ‘wrong’… the path and the name are the same.
Ideally you should tell the code where to find the file of the given name.
fileList[0].name should give you the filename, but it will need ‘something’ prepended to it to give the path and filename.
e.g.
var player4 = assetsManager.addMeshTask("player4", "", "assets/images/", "player.babylon");
you need to get your 2nd parameter to match the one when you submit it manually.
let url= “https://myhost.com/model.gltf”
or it might just need a / in front of it or ./ it depends where you store those images relative to the code you are executing (obviously) and if you can access that location.