Home All Groups Group Topic Archive Search About

Creating new directory on the server

Author
13 Jan 2006 6:57 PM
rsimlote
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

Author
13 Jan 2006 8:55 PM
Paul Henderson
> How can I create a directory programatically through ASP.NET code?

System.IO.Directory.CreateDirectory(<a physical path>); should work.
Author
14 Jan 2006 4:13 PM
Norman Crandall
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
>
Author
17 Jan 2006 10:16 PM
RS
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

AddThis Social Bookmark Button