Oh boy. Where to start?
First of all, the
FileName
property of the
PostedFile
object is just the name of the file
on the client. Your code is executing
on the server. You can't just open that path from the server, because it doesn't exist.
If you want to do something with the file on the server, you either need to save it to the server with the
SaveAs
method, or read the
InputStream
to access the raw file bytes.
Secondly, your code is executing
on the server. If you open an instance of Excel, it will open
on the server, where nobody will ever see it. And that's assuming you have Excel installed on the server, and have jumped through all the hoops documented in this Microsoft Knowledgebase article:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
You need to go back to basics and get an understanding of how websites work, and the difference between
the client and
the server.