in reply to uploading files in CGI

It looks to me like you should get a copy of the actual word file uploaded. Test that by ftping the original document over in binary (NOT TEXT) mode and seeing that the two files are the same.

After that you will need to do a conversion. This is not a simple job, so don't try to figure it out for yourself. Just use a utility. A brief search turned up word2x, give that a shot and report back whether it worked. If it does not you should be able to find another conversion utility out there.

UPDATE
Having read it again, I notice that your open does not have a die on failure. That is probably because you are copying the code example. But still in a CGI script you should:

use CGI::Carp 'fatalsToBrowser';
at the top so dies go back to the user, and then in your open:
open(UPLOAD, ">$tempfile") or die "Cannot write $tempfile: $!";
You should also have some sort of locking logic for cases where two people both launch the CGI at the same time (or one person double-clicks on submit). Simple Locking shows one approach you might want to use.