# File\_column and tmp files

**URL:** <https://www.ruby-forum.com/t/file-column-and-tmp-files/96049>\
**Category:** Rails\
**Created:** [January 22, 2006, 10:02pm UTC](https://www.ruby-forum.com/t/file-column-and-tmp-files/96049 "2006-01-22T22:02:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [January 22, 2006, 10:02pm UTC](https://www.ruby-forum.com/t/file-column-and-tmp-files/96049/1 "2006-01-22T22:02:34Z")

</div>

Hi again…

One more item… the file\_column plugin uses a tmp directory inside the  
/public directory to store a temporary uploaded item. But it looks like  
this folder is just going to grow and grow. Is there some way to clear  
this out or not cause this to happen?

Thanks once again!

---

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [January 22, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/file-column-and-tmp-files/96049/2 "2006-01-22T22:10:28Z")

</div>

John T. wrote:

> Hi again…
> 
> One more item… the file\_column plugin uses a tmp directory inside the  
> /public directory to store a temporary uploaded item. But it looks like  
> this folder is just going to grow and grow. Is there some way to clear  
> this out or not cause this to happen?
> 
> Thanks once again!

Well, I know why the tmp files are building up - they are the ones that  
are not removed when the other error I posted about happens. It seems  
file\_column is moving the file into it’s proper place, or trying to, and  
when the error occurs (‘same file’ - having to do with the case of the  
file), the file in the tmp directory is not removed.

Now I know why, but still don’t know how to fix it 😉

jt

---

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [January 22, 2006, 10:57pm UTC](https://www.ruby-forum.com/t/file-column-and-tmp-files/96049/3 "2006-01-22T22:57:47Z")

</div>

On 1/22/06, John T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Well, I know why the tmp files are building up - they are the ones that  
> are not removed when the other error I posted about happens. It seems  
> file\_column is moving the file into it’s proper place, or trying to, and  
> when the error occurs (‘same file’ - having to do with the case of the  
> file), the file in the tmp directory is not removed.

basically, the tmp files are removed once the model is saved without  
errors. Before this, file\_column can’t remove them, because they might  
be needed for a form that is redisplayed because of validation errors.

The idea is to use a cron-job that deletes all files in the tmp  
directory that are older than 24 hours or so. Right now, you have to  
write this yourself (should be trivial), but patches are welcome…

Sebastian

---

<div class="post-metadata">

**Author:** ![johnt519](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@johnt519](https://www.ruby-forum.com/u/johnt519)\
**Post date:** [January 22, 2006, 11:24pm UTC](https://www.ruby-forum.com/t/file-column-and-tmp-files/96049/4 "2006-01-22T23:24:19Z")

</div>

Sebastian K. wrote:

> On 1/22/06, John T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Well, I know why the tmp files are building up - they are the ones that  
> > are not removed when the other error I posted about happens. It seems  
> > file\_column is moving the file into it’s proper place, or trying to, and  
> > when the error occurs (‘same file’ - having to do with the case of the  
> > file), the file in the tmp directory is not removed.
> 
> basically, the tmp files are removed once the model is saved without  
> errors. Before this, file\_column can’t remove them, because they might  
> be needed for a form that is redisplayed because of validation errors.

Yeah, I did figure that out. Unfortunately, with the problem with the  
file case (at least on OS X), I can’t upload a file with an upper case  
name/extension.

Thanks.
