0

I used this article for show image after upload without refresh page.
Display image after upload without page refresh or postback using ASP.Net AsyncFileUpload Control
I customize the FileUploadComplete because I want to create name for uploaded files:

protected void FileUploadComplete(object sender, EventArgs e)
{
    string filename = System.IO.Path.GetFileName(AsyncFileUpload1.FileName);
    filename = Uploader.CreateNameForFile(filename);
    AsyncFileUpload1.SaveAs(Server.MapPath(this.UploadFolderPath) + filename);
    Session["image"] = filename;
}

After I change the code, Image doesn't shown after upload.
what do I do?

Izzy
  • 6,740
  • 7
  • 40
  • 84
Majid Basirati
  • 2,665
  • 3
  • 24
  • 46

1 Answers1

0

you have to have javascript for this scenario:

from code behind

url = location of saved image

ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "image", "top.$get(""" & _img.ClientID & """).src = '" & url & "';", True)

Display image after upload without page refresh or postback using ASP.Net AsyncFileUpload Control shows you how to do it from client side

Weafs.py
  • 22,731
  • 9
  • 56
  • 78