how to upload the resume in asp.net using c# the resume will be in .doc,.txt,.rtf,.docx format

Posted by Ramakrishna96 under ASP.NET on 3/1/2012 | Points: 10 | Views : 13709 | Status : [Member] | Replies : 2
Hi,how to upload resume in asp.net using c# the resume wil be in.doc,.docx,.rtf,.txt so please give me sample code for that





Thanks

k.ramakrishna


Responses

Posted by: Blessyjees on: 3/2/2012 [Member] Bronze | Points: 25

Up
0
Down
hi,

You can use file upload control to upload file.

Add below html content in your aspx page

<asp:FileUpload id="FileUploadControl" runat="server" />

<asp:Button runat="server" id="btnUpload" text="Upload" onclick="btnUpload_Click" />


add below code in cs file

protected void btnUpload_Click(object sender, EventArgs e)
{
if(FileUploadControl.HasFile)
{
try
{
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
}
catch(Exception ex)
{
//write error handling code
}
}
}


Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Ramakrishna96, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 3/2/2012 [Member] Bronze | Points: 25

Up
0
Down
If you need to restrict the file type

check the file extension before save and shows proper message.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Ramakrishna96, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response