473,698 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make folders/subfolder on server

I try to find som information about creating folders (and subfolders) on the
webserver using asp.net (1.0).
I have made a filuploader, and all files are now saved in the same folder on
the webserver. It had been smart if the users can make new directories in
this folder and save files in different folders/subfolders.

This is the code (example) I have used to upload the files to the server:
http://www.4guysfromrolla.com/webtech/091201-1.shtml

Hope anyone know how to create folders/subfolders using asp.net. Mabye some
code or a link to a tutorial or something would be fine :)

Thank you!!!
Feb 9 '06 #1
1 3287
Hi,

Øyvind Isaksen wrote:
I try to find som information about creating folders (and subfolders) on the
webserver using asp.net (1.0).
I have made a filuploader, and all files are now saved in the same folder on
the webserver. It had been smart if the users can make new directories in
this folder and save files in different folders/subfolders.

This is the code (example) I have used to upload the files to the server:
http://www.4guysfromrolla.com/webtech/091201-1.shtml

Hope anyone know how to create folders/subfolders using asp.net. Mabye some
code or a link to a tutorial or something would be fine :)

Thank you!!!


You create a directory in ASP.NET just like you would in a WinForms
application, i.e. you use the System.IO namespace and the classes
Directory, DirectoryInfo, File, FileInfo.

The only different is that that IIS runs under a different username,
because it's a service, and thus has different rights. You must make
sure that the ASPNET user on the local machine has write rights on the
directory containing the subdirectories. But if you can upload a file
already, the user probably already has the corresponding rights.

Relative paths are also sometimes tricky on ASP.NET. The best is to
determine an absolute path (for example using the web.config file, you
can specify which folder is the parent directory (absolute path), and
then create the new folder's absolute path using its parent's absolute
path... if you get what I mean.

Example: How to create a session directory

String pathUpload = ConfigurationSe ttings.AppSetti ngs[ "pathUpload " ];

// Prepare new directory for files
String newDirectory = Path.Combine( pathUpload, Session.Session ID );

// Check if directory exists and make sure we choose a unique path
if ( !Directory.Exis ts( newDirectory ) )
{
Directory.Creat eDirectory( newDirectory );
}
Note that directories created this way must also be deleted! Thus you
must keep a trace of them in the session, for example, and use the
Session_End event to delete them.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Feb 9 '06 #2

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

Similar topics

5
1817
by: George Hester | last post by:
If I have 1 Virtual Dirctory with 2 different subfolders are these 2 different folders different virtual folders? Or if I have 2 different Virtual Directories each containing a subfolder are these two subfolders 2 different virtual folders? I know it seems like a weird question but I'm asking because Microsoft is using the term "virtual folders" and I am not sure if they mean the former or the later. Thanks. -- George Hester...
2
2333
by: laura | last post by:
I am writing an intranet and want to be able to hyperlink to all files within a specific folder AND it's subfolders. Whilst I can hyperlink to the files in the specified folder AND I can also iterate through the subfolders and list them, for some reason I cannot hyperlink to the sub folders. I am writing this software at home using a computer that has IIS and Windows 98 and am accessing this as my server from another computer on my network....
3
1486
by: JV | last post by:
I'm trying to understand how ASP.NET creates web folders when it creates a new ASP.NET project. I am experienced with DotNet development, but not an expert on how IIS works. Or, this may be a question about FP Server Extensions..... When you create a web project in the default way, VS.NET has no trouble browsing for files. However, I like to keep all of my projects under a folder structure like C:\PROJECTS\ with a subfolder for each...
1
1311
by: Johnny Fugazzi | last post by:
I have a relatiovely simple need. I would like to have a webpage that a user can go to, fill out a couple of fields, and then hit OK where the result is that a Folder Template is copied and a new folder is created. The folders in question are on a IIS based FTP server. I am locking down the folder structure in an attempt to keep users from creating tons of oddly named and managed folders. Instead, I would like all new folder to be...
0
1249
by: erikjalevik | last post by:
I have now spent the best part of a day trying to find out how to distribute our unmanaged C++ app built with a newly purchased copy of VS2005. As per all the other posts, it runs fine on the dev machine but falls flat on its face on a test box without VS installed. As we use Inno Setup for the installer, we can't take the MSI route. Neither do I want to have to redistribute the vcredist.exe, so I've been trying to ship with the CRT as a...
2
1412
by: begum | last post by:
Hi everybody; It's me again :). We have folders and that folders has another folders. We want toread all te text files in that folders. We can only reach main folder and second subfolder.How can we reach lower-level subfolders.We try to write a loop function bu we didn't. Can anybody help us.? Thanks;
1
2354
by: Christian Heimes | last post by:
otaeris@o2.pl schrieb: As far as I remember the zip format it's not possible at all. Folders are created implicitly. The zip format doesn't support empty directories. Christian
6
2476
by: deve8ore | last post by:
Hello, We have a vendor that will supply us many files, and unfortunately will place them in different folders with no uniformity (within Windows Explorer). I'd like to have the capability to find and open the file based on name, whether it's in a main folder, or one of the subfolders. I could use a wildcard based on the file I'm trying to open. I.e. - File named "*Net Rebate*" will be in and of the following folders: Main Folder ...
8
1760
by: =?Utf-8?B?QnJ5YW4=?= | last post by:
Hello group. I have some code (given to me), but I don't know alot about ASP, so I was hoping someone here can help. Running on Win 2008 server. The code below will scan a folder and subfolder with a date/time input and return xml structure off all files that are newer than the supplied date/time. The problem is that the returned xml has path names like C:\folder\subfolder\filename.ext I would like it to be more like...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.