|
.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 quoteHide 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
Other interesting topics
Maintaining ASP.NET Sites
Only allow enter key in MultiLine textbox Class based on singleton pattern and instance methods in that clas RollOver and onMouseOver? Strong typing for user controls High memory in a ASP.NET application - how to monitor, what can cause? question re: date format in RSS news feeds How use newest userid in auto INSERT (2.0) delegation question sending email |
|||||||||||||||||||||||