FileReader error: The object is already busy reading Blobs

后端 未结 2 1044
你的背包
你的背包 2021-02-18 16:33

I\'m making a drag-and-drop file upload system for photo gallery uploads. This is my source code handling dropped files. This one works multiple files if I drop them one by one

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-18 17:25

    A case that can cause this is when a file reader gets called twice. If it's still running, it will issue this error.

        reader.onload = function( event ) {
                // do stuff
            };
        reader.readAsDataURL( file );
    
        /* arbitrarily complex code */
        reader.readAsDataURL( file2 );
    
        /* oops */
    

提交回复
热议问题