|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Creating new directory on the serverHi
I am developing a site, where the users upload images to the user's (/images/<username>) directory on the server. I am able to upload the file only if the directory already exist on the server, but for that I am manually craeting these directories on the server. How can I create a directory programatically through ASP.NET code? Thanks. Rahul > How can I create a directory programatically through ASP.NET code? System.IO.Directory.CreateDirectory(<a physical path>); should work.To get the physical path you can user server.mappath("/images/username/")
Norm On 1/13/06 12:57 PM, in article 1137178652.222446.309***@g49g2000cwa.googlegroups.com, "rsiml***@gmail.com" <rsiml***@gmail.com> wrote: Show quote > Hi > I am developing a site, where the users upload images to the user's > (/images/<username>) directory on the server. I am able to upload the > file only if the directory already exist on the server, but for that I > am manually craeting these directories on the server. How can I create > a directory programatically through ASP.NET code? Thanks. > Rahul > Hi Norman,
Thanks for replying. I tried doing what you suggested. I used Server.MapPath(path), but the problem is that it gives me path "C:\Inetpub\wwwroot\applname\images\username", which is correct however, it creats the directory and stores image on the client's machine. As I my development machine is also the development server as well as client for local testing, things were working fine, until I transferred my files on the production testing server, and the directories were still created on the client machine. Please help on how to get the server location, Thanks. Rahul |
|||||||||||||||||||||||