2010-06-11 73 views
1

有沒有一些方法可以使用類似於x-sendfile的東西來上傳文件,例如從請求到文件保存特定的流/參數,而不將其完全放入內存中? (特別是,的Apache2和紅寶石FCGI)上傳模擬XSendFile?

回答

0

Apache的ModPorter似乎是這樣。

0
require 'open-uri' 

CHUNK_SIZE = 8192 

File.open("local_filename.dat","w") do |w| 
    open("http://some_file.url") do |r| 
    w.write(r.read(CHUNK_SIZE)) while !r.eof? 
    end 
end 
+0

我認爲這不適用於接收一組cgi參數與數據的fcgi應用程序。 (我實際上是指這個:http://git.omp.am/?p=omploader.git;a=blob;f=scripts/upload;h=dc5b6e6fe76f3afbf3b4d2bfa8d46d6101c73d7f;hb=refs/heads/master#l153 ) – HoverHell 2010-06-11 13:05:13