# Lighttpd file upload issue - sporadic choke?

**URL:** <https://www.ruby-forum.com/t/lighttpd-file-upload-issue-sporadic-choke/48243>\
**Category:** Rails\
**Created:** [November 18, 2005, 3:09am UTC](https://www.ruby-forum.com/t/lighttpd-file-upload-issue-sporadic-choke/48243 "2005-11-18T03:09:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henryp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e68b1a/32.png) [@henryp](https://www.ruby-forum.com/u/henryp)\
**Post date:** [November 18, 2005, 3:09am UTC](https://www.ruby-forum.com/t/lighttpd-file-upload-issue-sporadic-choke/48243/1 "2005-11-18T03:09:37Z")

</div>

This has been driving me crazy: I have a file upload controller/view  
that finally uploads a file with this code in the controller:

File.open("#{filepath}/#{filename}", “wb”) do |f|  
f.write(@params[:document][:file].read)  
end

This works great for files large and small in webbrick and in on an  
Apache/FastCGI setup. However, on my production box which is running  
Lighttpd 1.4.7, this functionality fails about 50% of the time for  
files over 100 KB. When I say ‘fail’, I mean that the file just never  
appears in “#{filepath}/#{filename}”. The f.write command does not  
throw an error and no errors appear in log/production.log,  
log/fastcgi.crash.log or the lighttpd\_error.log. Very odd.

Is there some Lighttpd directive regarding upload file size I need to  
include in my .conf file? Some multipart chunk thing I need to know  
about? How should I go about getting to the bottom of this? (Please! I  
dread wrestling with FastCGI/Apache again.)

Your help/suggestions are greatly appreciated.

---

<div class="post-metadata">

**Author:** ![henryp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e68b1a/32.png) [@henryp](https://www.ruby-forum.com/u/henryp)\
**Post date:** [December 14, 2005, 11:53pm UTC](https://www.ruby-forum.com/t/lighttpd-file-upload-issue-sporadic-choke/48243/2 "2005-12-14T23:53:23Z")

</div>

I have the same issue, after 100K I have problem. Anybody has any idea?  
I work with file\_column + imagemagick

Any answer on this?

Henry P. wrote:

> This has been driving me crazy: I have a file upload controller/view  
> that finally uploads a file with this code in the controller:
> 
> File.open("#{filepath}/#{filename}", “wb”) do |f|  
> f.write(@params[:document][:file].read)  
> end
> 
> This works great for files large and small in webbrick and in on an  
> Apache/FastCGI setup. However, on my production box which is running  
> Lighttpd 1.4.7, this functionality fails about 50% of the time for  
> files over 100 KB. When I say ‘fail’, I mean that the file just never  
> appears in “#{filepath}/#{filename}”. The f.write command does not  
> throw an error and no errors appear in log/production.log,  
> log/fastcgi.crash.log or the lighttpd\_error.log. Very odd.
> 
> Is there some Lighttpd directive regarding upload file size I need to  
> include in my .conf file? Some multipart chunk thing I need to know  
> about? How should I go about getting to the bottom of this? (Please! I  
> dread wrestling with FastCGI/Apache again.)
> 
> Your help/suggestions are greatly appreciated.

---

<div class="post-metadata">

**Author:** ![henryp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e68b1a/32.png) [@henryp](https://www.ruby-forum.com/u/henryp)\
**Post date:** [December 15, 2005, 1:06am UTC](https://www.ruby-forum.com/t/lighttpd-file-upload-issue-sporadic-choke/48243/3 "2005-12-15T01:06:53Z")

</div>

Gokhan A. wrote:

> I have the same issue, after 100K I have problem. Anybody has any idea?  
> I work with file\_column + imagemagick
> 
> Any answer on this?

For me the answer was to clear the cache I had stowed in  
lib/image\_upload\_cache, make sure permissions were correct everywhere,  
clearing all past ruby session files and restarting the server. I’m not  
sure where file\_column caches things, but I would try and find out and  
clear it out. HTH

---

<div class="post-metadata">

**Author:** ![henryp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e68b1a/32.png) [@henryp](https://www.ruby-forum.com/u/henryp)\
**Post date:** [December 15, 2005, 11:20am UTC](https://www.ruby-forum.com/t/lighttpd-file-upload-issue-sporadic-choke/48243/4 "2005-12-15T11:20:18Z")

</div>

Hi Henry,

I was hitting an upload limit of 4mb, which was solved on the latest  
lighty release, 1.4.8. Also, if you’re using Safari (I believe there  
some issues with IE/PC as well), it might be worth adding this to your  
lighttpd.conf:

$HTTP[“useragent”] =~ “^(._MSIE._)|(._AppleWebKit._)$” {  
server.max-keep-alive-requests = 0  
}

Safari would choke on uploads above 64K, there was a thread about this  
on textdrive i think

- Oliver

2005/12/14, Henry P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![henryp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e68b1a/32.png) [@henryp](https://www.ruby-forum.com/u/henryp)\
**Post date:** [December 15, 2005, 11:20am UTC](https://www.ruby-forum.com/t/lighttpd-file-upload-issue-sporadic-choke/48243/5 "2005-12-15T11:20:19Z")

</div>

(not sure whether the keep-alive-requests was solved on 1.4.8, btw…  
might have)

2005/12/15, Oliver B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
