Image uploading in aspx page using c#
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit MohantyRank #112 · 20K reputationPosted Apr 10, 2023, 6:44 AM EDT
protected void UploadButton_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { try { string filename = Path.GetFileName(FileUpload1.FileName); string path = Server.MapPath("~/Images/" + filename); FileUpload1.SaveAs(path); StatusLabel.Text = "Upload status: File uploaded!"; } catch (Exception ex) { StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; } } else { StatusLabel.Text = "Upload status: Please select a file to upload."; } }Naimish MakwanaRank #324 · 7.7K reputationPosted Apr 10, 2023, 6:47 AM EDT
Please check below link:
https://www.dotnetcurry.com/ShowArticle.aspx?ID=68&AspxAutoDetectCookieSupport=1
https://learn.microsoft.com/en-us/shows/asp-net-site-videos/how-do-i-multiple-file-uploads-in-aspnet-2
Thanks