tmp must be a constant and we dont prevent nullpointerexception for filename.