Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

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

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted
Should have stated that I am working with a web project, will take a look at this byte array.

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...