How to set up a remote upload directory on a remote server for IIS
Posted on 2010-08-21
I am writing an ASP.NET application using C#.
This website will allow users to upload images.
The application will automatically place the uploaded image into a directory, based on the current year.
So for example, let's say the "root" directory is called "user_images"
The first time a user uploads a file for the year 2010, the application will automatically create a directory named "2010"
So the actual path to the 2010 directory is "C:\user_images\2010"
This application works fine on my local computer ;-)
Now I am ready to publish this web application to my web hosting company's web server.
They have Windows 2008 Servers running IIS and I can configure IIS using their admin control panel.
I know how to publish my actual web application to their web server.
But how do I create my "user_images" directory on their remote server?
I can't imagine they would give me access to the root of their server, so do I make a virtual directory in IIS called "user_images"?
If that's how it's done, then how do I modify my web.config file to point to this virtual directory? (right now the "user_images" directory is hard-coded in my web.config file as "C:\user_images\" ... I assume this won't work on the virtual server)
How do I configure permissions on that remote directory so that my web application has full control inside of that directory? (create additional directories, read images, delete images, move images, rename images)
Finally, I assume that it is best practice to NOT place my user upload directory ("user_images") inside of my web application's virtual directory, because each time I publish the website from Visual Studio, it warns me that it will delete all existing files before republishing. (If my user uploaded a bunch of images and then I made a change to the website and republished it, I'm thinking all of my user's images would be deleted)