# Big file uploads and number of records created

**URL:** <https://www.ruby-forum.com/t/big-file-uploads-and-number-of-records-created/128999>\
**Category:** Rails\
**Created:** [February 13, 2008, 12:50pm UTC](https://www.ruby-forum.com/t/big-file-uploads-and-number-of-records-created/128999 "2008-02-13T12:50:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fesplugas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@fesplugas](https://www.ruby-forum.com/u/fesplugas)\
**Post date:** [February 13, 2008, 12:50pm UTC](https://www.ruby-forum.com/t/big-file-uploads-and-number-of-records-created/128999/1 "2008-02-13T12:50:01Z")

</div>

I’ve an application which uploads files between 50 and 100 Megs.

On development everything works as expected. File is uploaded, file is  
processed and finally uploaded to AmazonS3.

On production the application works when I upload small files, but  
when I upload big files the application somehow creates as many  
records as Mongrel instances.

This means that if I’ve 4 mongrels, the files is generated 4 times and  
uploaded 4 times to S3.

As the problem was not being fixed I changed the model to not allow  
uploading the file more than once, so I added a  
`validate_uniqueness_of :file` … but Rails bypasses it … so the  
record is created also 4 times even having this constraint.

Does anyone had a similar problem and help me?

I’m running Rails 2.0.2, Mongrel 1.1.3 and Nginx 0.6.25

Thanks in advance,

Francesc
