Hi
Am in the process of trying to upload and download files from a web server. I have, at this point, the upload function operational:
Downloading on the otherhand, well thats a whole different ballgame, any suggestions on how to get around this problem? Have been searching the Internet, but can see nothing for downloading the file. The file that I am trying to download is a ".CSV" file.
Mike55
Am in the process of trying to upload and download files from a web server. I have, at this point, the upload function operational:
Code:
If Not (filMyFile.PostedFile Is Nothing) Then
Dim myFile As HttpPostedFile
myFile = filMyFile.PostedFile
'Get the size of the uploaded file.
Dim nFileLen As Int16
nFileLen = Convert.ToInt16(myFile.ContentLength)
'Verify that the file size is greater than 0
If nFileLen > 0 Then
'Allocate a buffer for reading of the file.
Dim myData((nFileLen)) As Byte
'Read uploaded file from the stream.
myFile.InputStream.Read(myData, 0, (nFileLen))
'Create a name for the file to store.
Dim strFilename As String = Path.GetFileName(myFile.FileName)
'Verify that the file is in the correct format, i.e. ".csv" or ".txt"
If verifyFileType(strFilename) = False Then
Me.lblInfo.Text = "File Type cannot be accepted."
Exit Sub
End If
'Write the file to the new location.
WriteToFile("C:\Suretxtlog\" + strFilename, myData)
'Export the file to the Database table.
WriteToDB(strFilename)
endif
Downloading on the otherhand, well thats a whole different ballgame, any suggestions on how to get around this problem? Have been searching the Internet, but can see nothing for downloading the file. The file that I am trying to download is a ".CSV" file.
Mike55