I need to have an image printed as a poster 32″ by 18″ (about 80x45 cm) at 300 DPI, but I am unsure of how big the file must be.
Also, what file format is best?
The straightforward answer to your question is very simple arithmetic: 32×300 = 9600 and 18×300 = 5400, so 32 inches by 18 inches at 300 dots per inch is 9600 by 5400.
However, it gets a little more complicated when you consider a more complicated relationship between pixels and colored dots in your output medium. For details on this, take a look at jrista's answer to a similar question: What DPI should I resize my image to for best printing quality?, at What does DPI mean?, and at Is there a general formula for image size vs. print size?
Also consider that 300dpi may be overkill for a poster, unless you expect your viewers to come right up to it and look closely. A much lower resolution will look great from a few feet away.
It sounds like you're doing something specific, though. In that case, the best answer is to ask your print service what they recommend — and the same thing goes for file format (and color space, a whole 'nuther can of worms).
If your print service offers multiple file types as an option, lossless TIFF or PNG will ensure that you don't introduce additional JPEG artifacts, but in practical terms you can get excellent results from a high-quality JPEG. (With high enough JPEG quality and no repeated edits, you probably will not be able to find experts who could tell the difference in a blind test.)