in reply to Re: File "rename" error in renaming a file.
in thread File "rename" error in renaming a file.

I tried moving it just outside of the "while" loop:
... open( ATTA, ">$tempfile" ) || die "Can't open $tempfile: $!"; binmode ATTA; rename $tempfile, "tempdir/".$new_filename or die "Cannot rename fil +e: $!"; } while ( <$attach> ) { ...

Got this error : " Error calling upload_file: '' is not a filehandle ".