How can I use ASP.NET/VB.NET to save a CSV File to Client Machine?
Posted on 2005-04-25
I thought this would be easier but I've been trying to figure it out for a while now. From a form, I want my site users to select a file path on their machine, when the form is submitted, the .csv file is generated based on their form input and saved in the location they chose. Sounds easy enough, but I'm having problems. I've got everything set up but the file logic.
So far I've got this in the .vb file.
Dim objStreamWriter as StreamWriter
objStreamWriter = File.CreateText(MapPath(" I want to put the file path the user chose here I think "))
in the aspx page I have this to prompt the user.
<form runat="server" id="login" enctype="multipart/form-data">
<input id="uploadedFile" type="file" runat="server">
After many google searches I still can't figure out how to extract the file name the user chose from the type="file" input box.
If the streamwriter object isn't the correct way to do this, then please let me know another way. But if this will work if I can get the file path then it looks fine.
Thank you for your time.