473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

check if file is being uploaded using FileSystemWatcher class

Maidenz08
Hi,

I am developing a monitoring tool which logs all the files that are being uploaded. I am using FileSystemWatcher class to achive this. When a file is selected for upload the Changed event of FileSystemWatcher 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
Mar 30 '09 #1
9 4065
tlhintoq
3,525 Expert 2GB
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?
Mar 30 '09 #2
@tlhintoq
I too was surprised initially. But it does trigger the changed event when that file is selected for upload..!!!


@tlhintoq
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..
Mar 31 '09 #3
tlhintoq
3,525 Expert 2GB
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?
Mar 31 '09 #4
@tlhintoq
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.
Apr 2 '09 #5
tlhintoq
3,525 Expert 2GB
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?
Apr 2 '09 #6
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.?
Apr 3 '09 #7
tlhintoq
3,525 Expert 2GB
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.
Apr 3 '09 #8
@tlhintoq
Yup thats right..

@tlhintoq
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......
Apr 8 '09 #9
tlhintoq
3,525 Expert 2GB
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 FileSystemWatcher. 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.
Apr 11 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Allen Anderson | last post by:
I'm trying to figure out a way to catch when a file has been written to a directory. I currently have it where I can catch when the file begins writing, but this isn't helpful as I need to know...
2
by: Jack David | last post by:
Using the code below I am able to monitor a single directory for a new file and then kick-off a process to deal with the file. The question is??? How would I modify this code to be able to monitor...
2
by: Raed Sawalha | last post by:
Hello , I have windows service which do listening to specified directory using FileSystemWatcher , on Created Event and Get all the files in the directory using Directory.GetFiles function then...
12
by: Anders Eriksson | last post by:
Hello! I'm trying to create a program that will watch a directory and when a file is created print that file. I have used FileSystemWatcher for watching the directory and I get an created event....
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
10
by: Ricardo Luceac | last post by:
Hi all. I'm having a problem with this, I have look if a file exists, if don't wait till it is created and if it exists I need to open it. I do the following: for (; ; ) {
5
by: ZWeng | last post by:
I created a windows service using FileSystemWatcher to moniter a folder for file drops. The service uses FileStream and StreamReader to read and process the file. After it is done, the file is...
2
by: Jason | last post by:
hi, i have an application that has a filesystemwatcher if this app is running...and the user attempts to shut the pc down (or log off) nothing happens.... if the program is stopped the user...
2
by: Suman | last post by:
Happy Friday everyone!!! I am working on a windows service and a C# application and needed some help with certain functionality. Please read through my issue below. Thanks! I have a windows...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.