Dispatch.fcgi && lighttpd file upload


#1

Hi,

as i’m aware that there are not too many out there still using
dispatch.fcgi && lighttpd (rather moving to mongrels && nginx ) , i’ll
try to make this simple:

how do i limit a file upload size in lighttpd? am i supposed to do this
via the app? i’ve racked the internet for a while now, and my mind is
heavy and stumped.

i’m running dispatch.fcgi && lighttpd as the web-server.

any help or references would be greatly appreciated.
thanks.


#2

Hi,

I still use dispatch.fcg && lighttpd.

Here are two things I do -

  1. Lighttpd config server.max-request-size option

http://trac.lighttpd.net/trac/wiki/server.max-request-sizeDetails

  1. In the app I use the file_column plugin (http://www.kanthak.net/
    opensource/file_column/) for file uploads and use the following in my
    model.

validates_filesize_of :image, :in => 5.kilobytes…2.5.megabyte

Hope this helps.

Cheers,

Ajay


#3

ajay wrote:

Hi,

I still use dispatch.fcg && lighttpd.

Here are two things I do -

  1. Lighttpd config server.max-request-size option

http://trac.lighttpd.net/trac/wiki/server.max-request-sizeDetails

  1. In the app I use the file_column plugin (http://www.kanthak.net/
    opensource/file_column/) for file uploads and use the following in my
    model.

validates_filesize_of :image, :in => 5.kilobytes…2.5.megabyte

Hope this helps.

Cheers,

Ajay

many thanks! i’ll check this out in a sec;
just as a note; i was having trouble beforehand on a different issue -
serving the css’s + gifs + static content straight via lighttpd rather
than going through dispatch; this works like a charm: (sped up my app)

lighttpd.conf


url.rewrite = ("^/$" => “index.html”, “^([^.]+)$” => “$1.html”,

this following line serves the static content via lighttpd rather than

sending it to the dispatch, and then serving it …

                            "^(.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|mov)(\?(v=|ver=)?\d+)?)$" 

=> “$1” )

later && thanks,

shai


#4

validates_filesize_of :image, :in => 5.kilobytes…2.5.megabyte

do i need rmagick for this? or is file_column plugin enough (this is my
case)?


#5

hmm… my understanding is that validates_filesize_of doesn’t require
rmagick but validates_image_size does.