Reconstructing a chunked file in Rails
-
01-03-2021 - |
题
I'm trying to build an HTML5 file uploader that supports large files via chunks. I've found enough documentation online to work with the frontend side of things but I see zero info about how to reconstruct the chunks once they hit the server (I'm using Rails.) Any help?
解决方案
So you have multiple files containing a chunk of the large file? Then just do
File.open("file", "w") do |large_file|
%w(file1.chunk file2.chunk file3.chunk).each do |chunk| # %w() creates an Array
large_file.write(File.read(chunk))
end
end
不隶属于 StackOverflow