1

I want to upload an image to ImageBox on an Asp.net webpage. I am using C# language and for the browse I used <asp:FileUpload> tag. Any Ideas Please?

Regards

<asp:FileUpload ID="imgUpload" runat="server"  />

2 Answers 2

1

You can assess uploaded file through FileUpload and save it using SaveAs method. You can read more over here.

string filename = Path.GetFileName(imgUpload.FileName);
FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
Sign up to request clarification or add additional context in comments.

6 Comments

OK, but HOw can I display it in the image box? I am doing this for Uploading a profile picture while registering for a website.
Set the ImageURL property with url of newly save image.
I tried this way ( imgProfile.ImageUrl = Server.MapPath("~/") + filename; ) but it didn't work
You do not need MapPath, imgProfile.ImageUrl = "~/" + filename;
Thanks...but can you add this part (mgProfile.ImageUrl = "~/" + filename;) to your answer Please.
|
0

try the links below i think these like can help. http://www.daniweb.com/forums/thread32985.html# http://www.daniweb.com/forums/thread112662.html#

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.