I apologise in advance for what must seem like such a dumb question. I have an ASP.NET 1.1 application that relies on a spreadsheet being imported into a SQL Server table. I've written a DTS package to perform the import and that works as expected. The spreadsheet is sent via an email because the owner does not have (and cannot be given) access to the web application. The spreadsheet attachment is saved either to the user's local hard disk or to a network share which I've configured through some keys in web.config.
I simply want to copy this file through my web application from the local (or network) drive to the web server. For example, the file might be in a location like this:
C:\Equipment\Spreadsheets\abc.xls
(this is on a local machine)and I want to copy it to:
C:\inetpub\wwwroot\TSP_Test\Equipment\
(this is on the web server machine)I'm using the AJAXUploader and can browse to the file but when I attempt to save it, the file has zero bytes, although the file name is correct.
Here's the code I'm using and I'm obviously missing something very simple:
Code: Visual Basic.NET
Dim fileStream As FileStream
Dim streamWriter As StreamWriter
Dim strExportFile As String = Server.MapPath(Me.ID) + "/" + ConfigurationSettings.AppSettings("ProtegeSpreadsheetLocation") + FileName
fileStream = New FileStream(strExportFile, FileMode.Create, FileAccess.Write)
streamWriter = New StreamWriter(fileStream)
streamWriter.Close()
fileStream.Close()
The filename in the AJAX uploader is correct as shown in the image below