File upload issue

Hi all,
I’m running my rails app with dispatch.fcgi && lighttpd in a environment
with memory issues(but no disk space issues). Whenever I try to upload a
file via http (simple multipart form with input type file) which size
is larger than memory available, the lighttpd process grows till fills
all the memory and consequently crashes.
What could I do to let upload files larger then memory available?
Its is a pretty blocking issuee and I’m without a clue…

Thank you in advance for any help.

I’m shamelessly bumping my own post, but, well, really noone as a clue?
Is there a way to make lighty buffer the file on the disk instead of
loading it in memory?
Should I upload the file in some other way?
Do I have eventually to change webserver?

Well, that is a pretty sticky problem. You’ll have to decent to system
level I guess. On debian systems you can call ‘free’ with returns the
current memory usage. This command can of course be called in Ruby(and
thus Rails) and then parsed to see how much memory there is still
available.
But I am not sure that will do you any good. As I remember from
attachment_fu you can ‘validate’ the file size but only after it
been uploaded. So that won’t help you. Perhaps javascript could
intervene clientside?

Sample output free:
$ free
total used free shared buffers
cached
Mem: 239820 216752 23068 0 35112
47252
-/+ buffers/cache: 134388 105432
Swap: 498004 249752 248252
$

On Dec 14, 12:35 pm, Emanuele R. [email protected]

I was not suggesting that you would validate the file size, I merely
pointed out a problem with attachment_fu in that respect.

As far as convincing Lighttpd to buffer the file to disk… I doubt
you can do that.

But seriously can’t you sent a piece of Javascript which does the
checking? Just spoke to our JS guy and he does not believe it
can be done. In php.ini there is a variable called
max_post_size(usually), perhaps a Mongrel/Apache/Lighttpd takes a
similar parameter?

On Dec 14, 1:24 pm, Emanuele R. [email protected]

Yes it seems pretty sticky…
anyway I do not seek a way to validate the file size since I need it to
be uploaded even knowing that it would be larger than the memory
available.
To be more clear: the file going to be uploaded through the app feature
will always be around 110Mb and the device has only 64 Mb of ram most of
wich is obviously already taken, so loading the file in memory is out of
question…
There should be another way. I would hope for a way to make lighttpd
buffer the file on disk… but anything else is apreciated.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs