views:

54

answers:

2

Is there some way to use something similar to x-sendfile for uploading files, e.g. saving particular stream/parameter from request to file, without putting it wholly into memory? (In particular, with apache2 and ruby fcgi)

A: 
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
zed_0xff
I think that isn't for fcgi application that receives set of cgi parameters with data.(I'm actually referring to this: http://git.omp.am/?p=omploader.git;a=blob;f=scripts/upload;h=dc5b6e6fe76f3afbf3b4d2bfa8d46d6101c73d7f;hb=refs/heads/master#l153 )
A: 

Apache's ModPorter seems to be the way.