Click here to Skip to main content
15,891,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am tying to upload a image file using asp async file upload.

C#
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {

        if (AsyncFileUpload1.HasFile)
        {
            string filext = Path.GetExtension(AsyncFileUpload1.FileName);
            if (filext == ".png")
            {

                //string path = Server.MapPath("temp/") + Path.GetFileName(e.FileName);
                string sessionId = this.Session.SessionID;
                string path = Server.MapPath("temp/") + sessionId + filext;
                AsyncFileUpload1.SaveAs(path);
                Response.Write("-" + path);
                string imgSrc = "temp/" + sessionId + filext;
                Session["projImage"] = path;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "showImage", "showImage('" + imgSrc + "');", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "errorMsgFunction", "errorMsgFunction();", true);
                return;

            }
        }

    }





C#
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "showImage", "showImage('" + imgSrc + "');", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "errorMsgFunction", "errorMsgFunction();", true);
            return;

        }









out of these the one with image works fine and i can preview correctly but the second javascript funcion doesnot work in chrome




C#
function showImage(imagePath)
       {

           $('#imgproj', window.parent.document).attr("src", imagePath);

       }






C#
function errorMsgFunction(sender, args)
        {
            $('#diverror', window.parent.document).show();
            $('#diverror', window.parent.document).fadeOut(2000);

//            $('.errorproj', window.parent.document).fadeIn(4000, function()
//            {

//                $('.errorproj', window.parent.document).fadeOut(2000, function()
//                {
//                    $('.errorproj', window.parent.document).remove();
//                });
//            });

//            $('#diverror', window.parent.document).fadeIn(500, function()  {
//                $('#diverror', window.parent.document).fadeOut('slow');

//            });

        }
Posted
Comments
ZurdoDev 30-Oct-12 13:27pm    
What does "not work" mean? Is there an error?

1 solution

nothing is haapening in firefox AND CHROME but it is working in IE
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900