Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Alright. I have my application watching my desktop, pictures, music, and document folders. I have seen examples of ftp similar to this:
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.drivehq.com/file.txt"), System.Net.FtpWebRequest)
        request.Credentials = New System.Net.NetworkCredential("user", "password")
        request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

        Dim file() As Byte = System.IO.File.ReadAllBytes("c:\file.txt")

        Dim strz As System.IO.Stream = request.GetRequestStream()
        strz.Write(file, 0, file.Length)
        strz.Close()
        strz.Dispose()
    End Sub
so for instance. this is the handler:

AddHandler watchfolder.Renamed, AddressOf logrename

What would I need to put into the sub logrename() in order for it to automatically upload the renamed file onto my server
Posted
Updated 22-Feb-12 11:41am
v2

Unlike file systems, FTP does not support notifications.

To implement the feature you want on some host running an FTP server, you would need to develop a special notification service. This service should work on the publisher-subscriber model (http://en.wikipedia.org/wiki/Publish-subscribe[^]), accept subscriptions for event notifications by network and provide network notifications if something changes in part of the file system covered by FTP, depending on user authentication.

Please see for the sketch of such architecture in my past answer:
Multple clients from same port Number[^].

Internally, if the service's host runs Windows, you can use the class System.IO.FileSystemWatcher, please see:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx[^].

For Windows systems, the adequate form of the service is a Windows Service. Please see:
http://en.wikipedia.org/wiki/Windows_service[^],
http://msdn.microsoft.com/en-us/library/d56de412%28v=vs.100%29.aspx[^].

—SA
 
Share this answer
 
The application is going to be a .net desktop application, that can upload the changed file onto the ftp server. The server runs Linux. It's with dreamhost.com
I was planning on using the system.io.filesystemwatcher, my problem is that I dont know how to change the ftp portion of my code to work with whatever file was changed, renamed or created...
 
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