1

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)

HoverHell
  • 4,739
  • 3
  • 21
  • 23

2 Answers2

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
zed_0xff
  • 32,417
  • 7
  • 53
  • 72
  • 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 ) – HoverHell Jun 11 '10 at 13:05
0

Apache's ModPorter seems to be the way.

HoverHell
  • 4,739
  • 3
  • 21
  • 23