473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Creating new directory on the server

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

Jan 13 '06 #1
3 1179
> How can I create a directory programatically through ASP.NET code?

System.IO.Directory.CreateDirectory(<a physical path>); should work.

Jan 13 '06 #2
To get the physical path you can user server.mappath("/images/username/")

Norm
On 1/13/06 12:57 PM, in article
11**********************@g49g2000cwa.googlegroups. com, "rs******@gmail.com"
<rs******@gmail.com> wrote:
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


Jan 14 '06 #3
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

Jan 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robert | last post by:
I get these errors when creating a asp .net web application project in VS 2003 on a remote web server: "Microsoft Development Environment The Web was created successfully, but an error occurred...
0
by: Ken Wigle | last post by:
All, I am trying to add some .net applications I wrote to a virtual directory underneath the sharepoint services web site. I am having some problems and wondering if a) this is possible and/or...
8
by: mcmg | last post by:
Hi, I have an asp app that works fine on a windows xp machine but does not work on a windows 2000 server. I have the following code in my global.asa: <OBJECT RUNAT=Server SCOPE=SESSION...
1
by: B. Zuidgeest | last post by:
I use C# to connect a database with student information directly to the Active Directory (2003). This means that as the student is enlisted an account and mailbox is created in the active...
6
by: Eran Kampf | last post by:
I am trying to dynamically create directories in my ASP.NET application (I am using Server.MapPath("/")+"test" as the folder) and I am getting a DirectoryNotFoundException saying "Could not find a...
9
by: Sheldon Cohen | last post by:
Hello, I am using c# and running a site that is on a shared host. The code in question is supposed to create a new directory that is coming out of a text box. It works fine on my computer, but...
3
by: James Coleman | last post by:
Hello, The following error is appearing when attempting to create a directory using the availale system.io methods: System.IO.DirectoryNotFoundException: Could not find a part of the path...
0
by: Peter D. Dunlap | last post by:
I have a number of web sites on my 2003 server, each of the independent sites (i.e., not subdirectories of the localhost site). The way I have always set these up in the past is: 1. Create a...
0
by: J'son | last post by:
Guys, I need to build a web intranet application that can automatically create a user account when a new user registers on the site. The user account will be on the web server, member of the...
7
by: andym | last post by:
Dear All, I wish to have an ASP page that displays a predetermined date in the middle of a string. I wish this date to be set in a seperate control panel type page. I am hoping somebody could...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.