# Mongrel error on read file after upload

**URL:** <https://www.ruby-forum.com/t/mongrel-error-on-read-file-after-upload/168557>\
**Category:** Rails\
**Created:** [May 22, 2009, 11:32am UTC](https://www.ruby-forum.com/t/mongrel-error-on-read-file-after-upload/168557 "2009-05-22T11:32:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [May 22, 2009, 11:32am UTC](https://www.ruby-forum.com/t/mongrel-error-on-read-file-after-upload/168557/1 "2009-05-22T11:32:31Z")

</div>

I have a java client that uploads files to a web server. The problem is  
that whenever the client uploads a file, and mongrel saves it in a  
temporary file (in this case, mongrel13800-0), mongrel can’t read the  
file resulting in the error below.

Read error: #\<Errno::EACCES: Permission denied -  
/home/Jim/work/tmp/mongrel3800-0\>

pastie link here: [http://pastie.org/486246](http://pastie.org/486246)

i’ve resolved the problem by setting Mongrel::Const::MAX\_BODY to 5MB,  
but i don’t really like that solution. And I have no control over the  
size of the uploads.

i’ve tried chmod and chown but it doesn’t solve the problem. any ideas?  
thanks!

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [May 22, 2009, 2:11pm UTC](https://www.ruby-forum.com/t/mongrel-error-on-read-file-after-upload/168557/2 "2009-05-22T14:11:17Z")

</div>

On May 22, 10:32 am, Jim ruther Nill \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> I have a java client that uploads files to a web server. The problem is  
> that whenever the client uploads a file, and mongrel saves it in a  
> temporary file (in this case, mongrel13800-0), mongrel can’t read the  
> file resulting in the error below.

Does the java code run as a different user than your mongrel ?

Fred

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [May 25, 2009, 2:52am UTC](https://www.ruby-forum.com/t/mongrel-error-on-read-file-after-upload/168557/3 "2009-05-25T02:52:18Z")

</div>

Frederick C. wrote:

> On May 22, 10:32ï¿½am, Jim ruther Nill \<rails-mailing-l…@andreas-  
> [s.net](http://s.net)\> wrote:
> 
> Does the java code run as a different user than your mongrel ?
> 
> Fred

i’ll try asking that to the java developers. I have no control over the  
java code. i’ll keep you posted. thanks!

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [May 26, 2009, 3:13am UTC](https://www.ruby-forum.com/t/mongrel-error-on-read-file-after-upload/168557/4 "2009-05-26T03:13:57Z")

</div>

Jim ruther Nill wrote:

> i’ll try asking that to the java developers. I have no control over the  
> java code. i’ll keep you posted. thanks!

i run the client in the same pc as the server. but it did not solve the  
problem. if it helps, using webrick doesn’t produce any errors.

one other thing i’m having trouble after the file is uploaded is this  
error:

CGI::Session::CookieStore::TamperedWithCookie

after the java client uploads the file to the server, before getting to  
the action that will handle the saving of the file, the server sends  
this error to the client. Looking at the request/response, the  
session\_key sent by the client is different from the session\_key sent by  
the server as a response. I looked around for a cause to this, and the  
only answer i found is when you change the secret key in your  
environment.rb file. and i haven’t done that. any clues?
