I have a requirement to upload a model through the web.
According to the documentation, I can get the base64 of the file through the file input to render the local model, but the model-related materials and images will not be loaded, right?
It depends on where the materials and images are stored. If they are in another local file (for example, an .mtl if it’s an OBJ, or image texture files for a .gltf) they will not load. In general, browsers are very secure and do not permit application code to touch anything except what the user explicitly uploaded. There is an exception to this however: the File System Access API. I am not sure if anyone has tried loading Babylon files this way - could be an interesting experiment!
OTOH, if the images or materials are stored in the file itself, they should load in and render correctly. For example, a GLB file has all resources binary-encoded into the file itself. These files should work without issue.
For reference, you may want to look into how the Babylon.js Sandbox handles file uploading. You can find the source here.
Thanks, Babylon.js Sandbox can solve my problem