Reputation: 4848
I have a web server with a web application and a website both on it (2 seperate entities within IIS7.0). The web application needs to be able to upload files to a virtual directory created within the same web server and the website needs to be able to view that virtual directory to be able to allow for downloading of those files.
This sounds really easy, but I cannot figure out how to do the upload and the download.
Example:
Virtual directory = own folder file structure (does not fall within either website/webapp structure)
Website - standard user for outside users.
Webapp - authentication requierd and only used by inside users.
Webapp users upload files to virtual directory Website users download files from virtual directory (i.e. open files)
can anyone help please.
Upvotes: 2
Views: 6287
Reputation: 41559
Accessing the directory:
The directory that is to contain the file will not be under the file structure of either one or the other website/app, (or maybe both if the directory is elsewhere in the filesystem). To give a website access to such a location you can create a virtual directory in the folder structure of your website which points to the location required. In IIS7 (Windows 7) the steps are:
Upload:
If you use the standard file upload control you will end up with a byte array and a name of the file once post back has occured. You can write the bytearray as a file with the desired file name
Download:
Either provide a link, or use a javascript window.open to the location that the file is saved in. Note that you might need to tweak IIS MIME type settings to allow the webserver to serve the file.
Upvotes: 1