C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Saving file retreived from Fileupload on server


Posted Date: 31 Aug 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms

Posted By: Tamanna       Member Level: Silver
Rating:     Points: 8



Saving file retrieved from File uploader FileUpload1 on server.
For saving any file on server we need use MapPath method of server class. And its saved location is being saved in string SaveLocation. Now this string can be used anywhere wherever there s requirement of using that file.


if((FileUpload1.PostedFile != null)&&(FileUpload1.PostedFile.ContentLength > 0))
{
string fn = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
string SaveLocation = Server.MapPath("Data") + "\\" + fn;
}




Responses

Author: ShyamPrasad    28 Nov 2008Member Level: Gold   Points : 1
Hi Tamanna !!!

this is gud.
But i want to save multiple files one time.How to do that using ASP.NET


Author: ShyamPrasad    28 Nov 2008Member Level: Gold   Points : 1
Hi Tamanna !!!

this is gud.
But i want to save multiple files one time.How to do that using ASP.NET


Author: vipul    28 Nov 2008Member Level: Diamond   Points : 1
Hi,
if((FileUpload1.PostedFile != null)&&(FileUpload1.PostedFile.ContentLength > 0))
instead of this we can used this
if(FileUpload1.HasFile)
{
}


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Saving file  .  Retreived from Fileupload  .  On server  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Vb.net code to display images and titles of Searched sale items by Price
Previous Resource: Preventing Unwanted background colouring of textboxes by google toolbar
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

conference call definitions

Contact Us    Privacy Policy    Terms Of Use