Web service to copy file on server

dakota97

Well-known member
Joined
Nov 14, 2003
Messages
113
Location
Pennsylvania
Hi all,

Its been a while, but Im back with another question. This time its dealing with files on my web server.

I have an application that uses FTP to transfer files from a local computer to my web server. The file needs to be copied into 2 different directories. The only problem is I dont want to have to upload the file twice through the local application. Is it possible to create a web service on the server that is called from the app that will copy the newly uploaded file from one directory on the server to another? Or, is there some kind of automated task that I can create that will monitor one folder and, if it sees a new file, copy it to the second folder?

Any suggestions will be greatly appreciated.

Thanks in advance,

-Chris
 
If the FTP server is under your control you could always create a simple application that uses the FileSystemWatcher class to detect the creation of a new file and then copy it.

Out of interest is there a reason why you need two copies of the file on the same ftp server?
 
Sorry about not getting back to you sooner. Had a family emergency over the weekend.

To give you a little background, Im creating a web application for a local high school booster club. Ive converted all of their existing static HTML pages to ASP.Net using C#. I then wrote a small "updater" application that the user enters the website changes into, which in turn inserts the data into a SQL database.

The reason I need 2 copies is because my client wants to be able to preview any changes to the site prior to posting them live. So, I created 2 seperate folders on the web server, one called "portal" and the other "preview". I basically duplicated the site files in both folders, and created the corresponding tables in the database. When changes are made, the data is inserted into the "preview" tables, and once they approve them, the records are then copied into the live database tables, deleted from the preview tables, and published on the site. This method might not be the best, but it was what I came up with given the limited amount of time that I had to complete the project (football season is now started).

So, what my thoughts are is to create a webservice that is called from the application after the user uploads a picture to the server. It would then find and copy the original file into the appropriate location, ultimately having 2 copies of the image on 2 different difrectories. Since the web server is obviously more powerful than the local machine, I figured it shouldnt take as much time to copy the file from one directory to another, as opposed to uploading the file via FTP a second time to the second location. Web space isnt a concern, but I figured that after the changes were approved, then I could delete the "preview" image from the directory.

Any thoughts?

-Chris
 
Back
Top