Load GLB file from local drive

Hi, I need help loading glb models from the local file system through file upload…
I have searched for a lot of method and most of them did not work for me.

let file = document.getElementById('large-importer').files[0];
				var urlx = URL.createObjectURL(new Blob([file]));

				BABYLON.SceneLoader.ImportMesh("", urlx, '', scene, function(){alert(200)}, ".glb");

, I wanted to use BABYLON FilesInput, but I dont know how…
thanks for your reply

@carolhmj could you have a look into this one ?

1 Like

Sure! A good starting point would be taking a look into this discussion. The question was about STL files, but the solutions there apply to GLB as well: STL file browser - Questions - Babylon.js (babylonjs.com)


Thanks, this solves most of my problem…
Btw, do you know how I can load a model without extension? I want to use AssetsManager for that too, thanks.

If the provided model doesn’t have an extension, Babylon is going to try loading it as if it was a .babylon file. If you want to provide the model’s correct type, you can use the methods in SceneLoader, which accept an “pluginExtension” parameter: SceneLoader | Babylon.js Documentation (babylonjs.com)