BlazorInputFile icon indicating copy to clipboard operation
BlazorInputFile copied to clipboard

File not uploading while upload very large files with a few GB

Open Gopigovin opened this issue 6 years ago • 1 comments

Hi Team,

I have tried to upload very large files with a few GB(2GB), but the browser tab crashes and the file not upload. Let me know any restriction for upload file size.

Please let me know any other way to upload large file ?

Regards, Gopi G.

Gopigovin avatar Oct 16 '19 09:10 Gopigovin

The javascript part of this library causes the entire file to be read into memory: https://github.com/SteveSandersonMS/BlazorInputFile/blob/fbd0f341da2dca8bfa152ff73816c86213faaab9/BlazorInputFile/wwwroot/inputfile.js#L125-L133

I was able to confirm by modifying InputFile.razor to:

<input type="file" @ref="inputFileElement" id="fileselector" @attributes="UnmatchedParameters" />

And then by calling in the console:

BlazorInputFile.readFileData(document.getElementById("fileselector"), 1, 0, 10);

The browsers memory allocation immediately jumped to 1.5GB (using a 1.5GB file as test).

This is supposed to help it: https://stackoverflow.com/questions/14438187/javascript-filereader-parsing-long-file-in-chunks

jespersh avatar Jun 12 '20 22:06 jespersh