Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

It's been a while, but I'm 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 don't 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(computer.speed == "slow")
    {  
       hamster.feed();  
    }
if(computer.speed == "really slow")
    {  
        hamster.kill();
        BuyNewHamster();
    }

  • Administrators
Posted

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?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Sorry about not getting back to you sooner. Had a family emergency over the weekend.

 

To give you a little background, I'm creating a web application for a local high school booster club. I've 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 shouldn't 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 isn't a concern, but I figured that after the changes were approved, then I could delete the "preview" image from the directory.

 

Any thoughts?

 

-Chris

if(computer.speed == "slow")
    {  
       hamster.feed();  
    }
if(computer.speed == "really slow")
    {  
        hamster.kill();
        BuyNewHamster();
    }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...