I've setup, through DTS, my linked server as an .xls file.
What I want to do is have a .aspx page which allows the user to upload a .xls file to the following database server directory:
C:\TestSaving\
I've got the code to read the file once it's in the directory and select all the rows from the .xls file and insert them into a table, but I can't get the file to save into the database server directory above. I had to hand create it to get the whole update process to work.
Here's my code:
***************
Dim getmyFile As HttpPostedFile = myfile.PostedFile
Label2.Text = "Line 76"
If IsNothing(getmyFile) Then
Label2.Text = "Please select a file to upload"
Else
If getmyFile.ContentLength = 0 Then
Label2.Text = "Cannot upload zero length File"
Else
Dim ServerFileName As String = Path.GetFileName(myfile.PostedFile.FileName)
Server.MapPath("//db2")
getmyFile.SaveAs("C:\TestSaving\" & ServerFileName)
Label2.Text = "Successful upload to C:\TestSaving\" & ServerFileName
****************
Any suggestions are welcome!
Thanks!
What I want to do is have a .aspx page which allows the user to upload a .xls file to the following database server directory:
C:\TestSaving\
I've got the code to read the file once it's in the directory and select all the rows from the .xls file and insert them into a table, but I can't get the file to save into the database server directory above. I had to hand create it to get the whole update process to work.
Here's my code:
***************
Dim getmyFile As HttpPostedFile = myfile.PostedFile
Label2.Text = "Line 76"
If IsNothing(getmyFile) Then
Label2.Text = "Please select a file to upload"
Else
If getmyFile.ContentLength = 0 Then
Label2.Text = "Cannot upload zero length File"
Else
Dim ServerFileName As String = Path.GetFileName(myfile.PostedFile.FileName)
Server.MapPath("//db2")
getmyFile.SaveAs("C:\TestSaving\" & ServerFileName)
Label2.Text = "Successful upload to C:\TestSaving\" & ServerFileName
****************
Any suggestions are welcome!
Thanks!