Yes fileName gives you the file name, you will need to add references. On my code i have below references
using Microsoft.Office.InfoPath;
using System;
using System.Xml;
using System.Xml.XPath;
using System.Text;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using mshtml;
i dont know which all you need.
The code works for me in IP07