Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to upload a textfile to another server through ftp using vb.net---Please its urgent

how to upload a textfile to another server through ftp using vb.net---Please its urgent

Scheduled Pinned Locked Moved Visual Basic
csharpsysadmintutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    preethishivbaba
    wrote on last edited by
    #1

    Dear all, We have a system wherein an output file is generated by some other program other than .Net.The output file is a textfile.Now we have to upload this textfile into the client's server through ftp(or whichever way its possible)using vb.net. Can u please suggest me some code on this.PLEASE..deadline's just ahead. thanks in advance, Preethi.

    preethishivbaba

    A 1 Reply Last reply
    0
    • P preethishivbaba

      Dear all, We have a system wherein an output file is generated by some other program other than .Net.The output file is a textfile.Now we have to upload this textfile into the client's server through ftp(or whichever way its possible)using vb.net. Can u please suggest me some code on this.PLEASE..deadline's just ahead. thanks in advance, Preethi.

      preethishivbaba

      A Offline
      A Offline
      Aadira
      wrote on last edited by
      #2

      Hi, You can actually create a windows service with filesystemwatcher, which keeps watching the creation of any new text files. The code within the windows service looks something similar to the below: Protected Overrides Sub OnStart(ByVal args() As String) InitializeEventLog() InitializeFileWatcher() InitializeMailServer() End Sub In the InitializeFileWatcher, specify the ftp folder path and add an event handler, Private Sub InitializeFileWatcher() fsWatcher = New FileSystemWatcher fsWatcher.Path = "\\FTP\Folder\*.txt" fsWatcher.NotifyFilter = (NotifyFilters.DirectoryName Or NotifyFilters.FileName) fsWatcher.IncludeSubdirectories = True 'watcher.NotifyFilter = NotifyFilters.FileName 'watcher.NotifyFilter = NotifyFilters.DirectoryName ' Only watch text files. fsWatcher.Filter = "*.txt" ' Add event handlers. AddHandler fsWatcher.Created, AddressOf OnTextFileCreated ' Begin watching. fsWatcher.EnableRaisingEvents = True End Sub so, in the OnTextFileCreated sub procedure, load the data from text file to the local server Private Sub OnTextFileCreated(ByVal source As Object, ByVal e As FileSystemEventArgs) 'Code for loading text data to local server-database End Sub So, whenever there are new text files created in the specified FTP folder, the event is raised and the text file data is loaded to the server. Vidya

      P 1 Reply Last reply
      0
      • A Aadira

        Hi, You can actually create a windows service with filesystemwatcher, which keeps watching the creation of any new text files. The code within the windows service looks something similar to the below: Protected Overrides Sub OnStart(ByVal args() As String) InitializeEventLog() InitializeFileWatcher() InitializeMailServer() End Sub In the InitializeFileWatcher, specify the ftp folder path and add an event handler, Private Sub InitializeFileWatcher() fsWatcher = New FileSystemWatcher fsWatcher.Path = "\\FTP\Folder\*.txt" fsWatcher.NotifyFilter = (NotifyFilters.DirectoryName Or NotifyFilters.FileName) fsWatcher.IncludeSubdirectories = True 'watcher.NotifyFilter = NotifyFilters.FileName 'watcher.NotifyFilter = NotifyFilters.DirectoryName ' Only watch text files. fsWatcher.Filter = "*.txt" ' Add event handlers. AddHandler fsWatcher.Created, AddressOf OnTextFileCreated ' Begin watching. fsWatcher.EnableRaisingEvents = True End Sub so, in the OnTextFileCreated sub procedure, load the data from text file to the local server Private Sub OnTextFileCreated(ByVal source As Object, ByVal e As FileSystemEventArgs) 'Code for loading text data to local server-database End Sub So, whenever there are new text files created in the specified FTP folder, the event is raised and the text file data is loaded to the server. Vidya

        P Offline
        P Offline
        preethishivbaba
        wrote on last edited by
        #3

        Vidya, thanks a lot.I am gonna try this and get back to you. Preethi.

        preethishivbaba

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups