Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster Tony John
Online Members
baskar
More...
Resources
»
Code Snippets
»
C# Syntax
How to Upload Files Using FileUpload Tool in ASP.NET.
Posted Date:
01-Jul-2008
Category:
C# Syntax
Author:
Rumpa M
Member Level:
Gold
Points
: 7
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string filename = Session.SessionID + FileUpload1.FileName;
string extn = System.IO.Path.GetExtension(FileUpload1.FileName);
if (extn == ".bmp" || extn == ".jpg" || extn == ".jpeg" || extn == ".png" || extn == ".gif")
{
string photo = Server.MapPath("upload") + "\\" + uname + "\\" + filename;
FileUpload1.PostedFile.SaveAs(photo.Trim());
string save_path = ".\\upload" + "\\" + uname + "\\"+ filename;
fl.get_username = Session["username"].ToString();
fl.get_caption = TextBox1.Text;
fl.get_photo = save_path;
fl.upload_file();
}
}
}
Did you like this resource? Share it with your friends and show your love!
Tweet
Responses to "How to Upload Files Using FileUpload Tool in ASP.NET."
No responses found. Be the first to respond...
Feedbacks
Post Comment:
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
Name:
Sign In
to fill automatically.
Email:
(Will not be published, but
required
to validate comment)
Type the numbers and letters shown on the left.
Next Resource:
Check if a number is prime or not!
Previous Resource:
How to Download Picture Forcefully from GridView/DataList
Return to Resources
Post New Resource
Category:
C# Syntax
Post resources and
earn money
!
More Resources
Check if a number is prime or not!
Forget Password recovery by mail
Using Delegate with Generic List to find an Item(s)
Format currency according to a specific culture using NumberFormatInfo class
change page title at run time
convert milliseconds into time
Popular Tags
Tag posting guidelines
Search Tags
(No tags found.)
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
Pawan Awasthi
(68)
Phagu Mahato
(10)
Raj.Trivedi
(9)
Last 7 Days
baskar
(298)
Pawan Awasthi
(178)
Asheej T K
(173)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds