A Tempfile is used to create a temporary file with a unique file name, which will be cleaned up by the garbage collector or when the ruby interpreter exits.
Tempfiles behave like File objects, but I am not sure if you can rename files and if you can, if the automatic cleanup described above will still work. Additionally you might break the constraint of unique file names if you change the temporary file name manually.
I suggest creating an ordinary file and specify the entire name by yourself (the succ method can be helpful to prevent name clashes).
Another solution might be setting the file name during or after the upload process, you mentioned.