Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET
hi i created uploading and i want to create folder and want to name for that folder while to do that can any one help me??
or for example..
in my aspx project i created many folders with name and while uploading i want to save in that particular folder..can any one suggest me..?
or can i try like this for example..
[browse file]
here i wil describe..when i browse file and enter in textbox filed as Path(mean i want to save in that folder which i created in my project so i wil type that folder name to that text box..after that i wil click uploadbutton so when i upload i want tat file into that entered folder...can any one can we do like that?? i will show u my code and where i have to make changes for that help me for this...
protected void btnUpload_Click(object sender, EventArgs e)

       if (FileUpload1.HasFile == false)
           UplodDetails.Text = "Please first select a file to upload...";
           UplodDetails.Text = string.Format(@"Uploaded file: {0}<br />File size (in bytes):{1:N0}<br />Content-type: {2}",
           string filePath =
           Server.MapPath("~Uploader" + FileUpload1.FileName);

Posted 27-Feb-12 23:31pm
Edited 28-Feb-12 20:07pm
ythisbug at 29-Feb-12 1:36am
i told my idea.or suggest me how to do with different method..thanks

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

 if (!Directory.Exists(Server.MapPath(filePath)))
 {                                      Directory.CreateDirectory(Server.MapPath(filePath));
ythisbug at 28-Feb-12 23:42pm
wat u mean by directory ?can u describe here..m getting error..
ryanb31 at 29-Feb-12 8:33am
It is under the System.IO namespace.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web03 | 2.8.150302.1 | Last Updated 29 Feb 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100