Topic: temp file question

I am trying to create a paperclip attachment from a temp file, but I am finding that when I do:

temp_file ="")

I get:

And then later on, when the paperclip attachment is served, the file I receive is

I am wondering how can I get rid of those numbers in the file name?



Last edited by patrick99e99 (2010-05-02 14:36:12)

Re: temp file question

Well you could overwrite the Tempfile.make_tmpname method: … pfile.html

But then you could get problems if you had files with the same name being uploaded. You'd probably be better doing something with callbacks like in these examples: … paperclip/ … ttachments

And do something like this:

filename.gsub(/,\d+,\d(\.\w{1,3})$/, $1)

(disclaimer: haven't tested smile)


Last edited by alexpt (2010-05-03 04:44:56)

Re: temp file question


Thanks alex..  That worked out great...