check if file is being uploaded using FileSystemWatcher class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maidenz08
    New Member
    • Sep 2007
    • 31

    check if file is being uploaded using FileSystemWatcher class

    Hi,

    I am developing a monitoring tool which logs all the files that are being uploaded. I am using FileSystemWatch er class to achive this. When a file is selected for upload the Changed event of FileSystemWatch er is fired. But is there any way of knowing that the event is fired for upload only. Coz the changed event is fired even when the file is renamed.

    Is there any other "Better" way of logging the files that were uploaded.

    Thanks,

    Alvin
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    I'm curious.. How is that just selecting a file is causing a 'change' event? The OpenFileDialog shouldn't be doing that.

    I don't believe there is any reasonable way to detect the reason or cause of a file change. Several file changes occur as a file is written because the size keeps changing. If someone marks the file as "read-only" attribute, that's a change. If the file is opened, worked on, and saved that's a change, rename is a change.

    How are you going about selecting files for up load, the way your program stands right now?

    Comment

    • Maidenz08
      New Member
      • Sep 2007
      • 31

      #3
      Originally posted by tlhintoq
      I'm curious.. How is that just selecting a file is causing a 'change' event? The OpenFileDialog shouldn't be doing that.
      I too was surprised initially. But it does trigger the changed event when that file is selected for upload..!!!


      Originally posted by tlhintoq
      I don't believe there is any reasonable way to detect the reason or cause of a file change. Several file changes occur as a file is written because the size keeps changing. If someone marks the file as "read-only" attribute, that's a change. If the file is opened, worked on, and saved that's a change, rename is a change.

      How are you going about selecting files for up load, the way your program stands right now?
      Actually i do not have an upload control in my app. I watch for a particular folder and need to capture any file that is being uploaded from anywhere. like say gmail or yahoo..

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        Actually i do not have an upload control in my app. I watch for a particular folder and need to capture any file that is being uploaded from anywhere. like say gmail or yahoo..
        I meant, how is your program keeping a list of which files need to be uploaded?
        At some point you have to be creating a list of what to upload and then working off that list, right?

        Comment

        • Maidenz08
          New Member
          • Sep 2007
          • 31

          #5
          Originally posted by tlhintoq
          I meant, how is your program keeping a list of which files need to be uploaded?
          At some point you have to be creating a list of what to upload and then working off that list, right?
          Thanks for your response

          I do not have a list of files. I just have a folder that i need to monitor (eg : C:\Data) and if anyone tries to upload any file that is present in C:\Data i need to capture it.

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            Let's try this from another angle....

            Your user selects the file to upload via a standard FileOpenDialog, right?
            Why are you not using the file path returned from the FileOpenDialog?

            Comment

            • Maidenz08
              New Member
              • Sep 2007
              • 31

              #7
              how can i access the return path of the FileOpenDialog as the FileOpenDialog control is not present in my app. It could be from any web app. Is there an event which will be triggered which i can capture to read the return path.?

              Comment

              • tlhintoq
                Recognized Expert Specialist
                • Mar 2008
                • 3532

                #8
                I am now completely lost as to how you are trying to do this.

                If you aren't using a FileOpenDialog to select files to upload then how are your users deciding what files your application should upload?

                Oh. Wait...
                I am developing a monitoring tool which logs all the files that are being uploaded.
                Your users aren't using your application. They aren't telling your application anything, are they? You application is sitting quietly in the background watching folders and trying to determine what is being uploaded. Is that right?

                Sounds like spyware.

                Comment

                • Maidenz08
                  New Member
                  • Sep 2007
                  • 31

                  #9
                  Originally posted by tlhintoq

                  Your users aren't using your application. They aren't telling your application anything, are they? You application is sitting quietly in the background watching folders and trying to determine what is being uploaded. Is that right?
                  Yup thats right..

                  Originally posted by tlhintoq
                  Sounds like spyware.
                  U can name it that if you want to. But we need to use this in an advertising agency where ideas are being stolen. So......

                  Comment

                  • tlhintoq
                    Recognized Expert Specialist
                    • Mar 2008
                    • 3532

                    #10
                    Sorry for the lag in response: I'm doing an installation in Alaska.
                    I think you're going to have to find a different way to cut down on the theft.
                    There isn't a way to determine *why* a file is being changed through a FileSystemWatch er. You know know that it is being changed and a few other particulars but not by which program or for what reason.

                    You would be better off restricting and monitoring the email itself, than trying to watch the files. Don't allow use of non-company issued email addresses. For example. But someone can copy the ideas of the files in so many ways... copy the server file to the local desktop then upload it would be an easy way to circumvent what you're trying to do. Taking screen snapshots of the files while open and leaving with them on thumbdrive. Taking snapshots of a monitor with their cell phone while lower resolution is still a way to steal the idea even if they have to re-create the file.

                    Comment

                    Working...