Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
How to upload file in vb.net windows application please help me
Sorry guys it is File not Excel File
Posted
Updated 21-Jan-11 3:55am
v4
Comments
Sergey Alexandrovich Kryukov 21-Jan-11 2:03am    
Are you sure you're asking just about upload? If so, what's the difference what kind of file, excel or not?
Sandeep Mewara 21-Jan-11 3:22am    
Nice question! :)
Sandeep Mewara 21-Jan-11 3:24am    
I think you want to upload data from excel to DB. Right?
Indivara 21-Jan-11 9:55am    
Fixed title

How about My.Computer.Network.UploadFile

Or this may be helpful to you:
An FTP client library for .NET 2.0[^]
 
Share this answer
 
For uploading data from Excel to database, look here:
Link 1[^]
Link 2[^]

If needed more, just Google it!
 
Share this answer
 
Just do this simply :

<pre lang="vb">If (Not File1.PostedFile Is Nothing) _
   And (File1.PostedFile.ContentLength > 0) Then
   'determine file name
   Dim sFileName As String = _
      System.IO.Path.GetFileName(File1.PostedFile.FileName)
   Try
      If File1.PostedFile.ContentLength <= lMaxFileSize Then
         'save file on disk
         File1.PostedFile.SaveAs(sFileDir + sFileName)
         lblMessage.Visible = True
         lblMessage.Text = "File: " + sFileDir + sFileName + _
            " Uploaded Successfully"
      Else    'reject file
         lblMessage.Visible = True
         lblMessage.Text = "File Size if Over the Limit of " + _
            lMaxFileSize
      End If
   Catch exc As Exception    'in case of an error
      lblMessage.Visible = True
      lblMessage.Text = "An Error Occured. Please Try Again!"
      DeleteFile(sFileDir + sFileName)
   End Try
Else
   lblMessage.Visible = True
   lblMessage.Text = "Nothing to upload. Please Try Again!"
End If



Well, File1 is some control that handle file upload or open. Find it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900