TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Eddie Jack
NA
156
139.1k
Rename file while uploading file in specific folder
Jul 29 2011 12:03 AM
Hi…
I want to rename my file name that while I am uploading file in my files folder. Which
changes should I do in below code?. New name should be pick from text box.
protected
void
Upload_Click(
object
sender,
EventArgs
e)
{
String
strFilename =
Path
.GetFileName(FileUpload1.FileName);
String
StrFilePathName =
String
.Empty;
String
strBaseDir =
AppDomain
.CurrentDomain.BaseDirectory +
"Files"
;
if
(!
Directory
.Exists(strBaseDir))
{
Directory
.CreateDirectory(strBaseDir);
}
StrFilePathName = strBaseDir +
"\\"
+ strFilename;
FileUpload1.SaveAs(StrFilePathName);
if
(!FileUpload1.HasFile)
return
;
Response.Redirect(
"~/Default2.aspx"
);
}
Reply
Answers (
2
)
Refreshing Data
How to Avoid Crystal Report Load Delay?