# Dispatch.fcgi && lighttpd file upload

**URL:** <https://www.ruby-forum.com/t/dispatch-fcgi-lighttpd-file-upload/104040>\
**Category:** Deployment\
**Created:** [May 13, 2007, 3:37pm UTC](https://www.ruby-forum.com/t/dispatch-fcgi-lighttpd-file-upload/104040 "2007-05-13T15:37:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@shai](https://www.ruby-forum.com/u/shai)\
**Post date:** [May 13, 2007, 3:37pm UTC](https://www.ruby-forum.com/t/dispatch-fcgi-lighttpd-file-upload/104040/1 "2007-05-13T15:37:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![shai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@shai](https://www.ruby-forum.com/u/shai)\
**Post date:** [May 14, 2007, 10:44am UTC](https://www.ruby-forum.com/t/dispatch-fcgi-lighttpd-file-upload/104040/2 "2007-05-14T10:44:29Z")

</div>

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](http://trac.lighttpd.net/trac/wiki/server.max-request-sizeDetails)

1. In the app I use the file\_column plugin ([http://www.kanthak.net/](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

---

<div class="post-metadata">

**Author:** ![shai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@shai](https://www.ruby-forum.com/u/shai)\
**Post date:** [May 15, 2007, 10:26am UTC](https://www.ruby-forum.com/t/dispatch-fcgi-lighttpd-file-upload/104040/3 "2007-05-15T10:26:11Z")

</div>

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](http://trac.lighttpd.net/trac/wiki/server.max-request-sizeDetails)
> 
> 1. In the app I use the file\_column plugin ([http://www.kanthak.net/](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

---

<div class="post-metadata">

**Author:** ![shai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@shai](https://www.ruby-forum.com/u/shai)\
**Post date:** [May 15, 2007, 11:00am UTC](https://www.ruby-forum.com/t/dispatch-fcgi-lighttpd-file-upload/104040/4 "2007-05-15T11:00:53Z")

</div>

> > 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)?

---

<div class="post-metadata">

**Author:** ![shai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@shai](https://www.ruby-forum.com/u/shai)\
**Post date:** [May 17, 2007, 12:37pm UTC](https://www.ruby-forum.com/t/dispatch-fcgi-lighttpd-file-upload/104040/5 "2007-05-17T12:37:27Z")

</div>

hmm… my understanding is that validates\_filesize\_of doesn’t require  
rmagick but validates\_image\_size does.
