title: Cannot read property 'lastIndexOf' of null error when trying to upload a gltf file using react threejs
body: <p>I am trying to upload a gltf file in reactjs and show it.But i am getting this error in the load function:</p>
  <pre><code>TypeError: Cannot read property 'lastIndexOf' of null
  </code></pre>
  <p>this is for the input file:</p>
  <pre><code>&lt;input id=&quot;files&quot; type=&quot;file&quot;  onChange={this.handleGltf} type=&quot;file&quot;/&gt;
  </code></pre>
  <p>This is the onchange fuction where i load the gltf file with three.js:</p>
  <pre><code>  handleGltf(event) {
          if (event.target.files[0]) {
              this.setState({
                  file: URL.createObjectURL(event.target.files[0])
              })
          }
  </code></pre>
  <p>I get the error from this gltf loader inside the onchange function:</p>
  <pre><code>this.loader.load(this.state.file,   gltf =&gt; {
  
                  console.log(this.state.file)
                  this.gltf = gltf.scene
                  console.log(&quot;check5&quot;)
  
                  // ADD MODEL TO THE SCENE
                  this.scene.add(gltf.scene);
      
                  this.control.attach( gltf.scene );
                  this.scene.add( this.control );
  
                  //
                  gltf.scene.scale.set(3, 3, 3)
                  this.orbit.update();
  
                  this.renderer.render(this.scene, this.camera);
              }, undefined,
  
              error =&gt; {
                  console.log(error);
              });
  </code></pre>
  <p>How can i resolve this issue?</p>