HTML5 File API and AJAX Upload Chunking question
I have written a drag and drop multiple file upload with individual progresses, etc. It works very nicely, except for one thing. when uploading larger files, sometimes the browser will lock up until the upload is complete. I think this is because the file is being stored in the browser's memory and taking up all the resources available to th开发者_StackOverflow社区e browser. what I'm wondering, is it possible to read files piece by piece and stream the chunks through an Ajax request as they are read? I think this might possible with FileReader but I haven't worked with it.
I'm sorry I can't provide any code as I am on my smartphone, but I will post some when I get a chance if it is needed.
I found the answer if anyone happens to have the same issues I had. Here is a link with the solution: http://www.thecssninja.com/javascript/fileapi
Yes you can use FileReader api for chunking the file. We have slice method to chunk file.
var filepart=file.slice(start,end);
To get more performance of using mulitpart sending data do it with in webworkers.
精彩评论