how to show the save dialog box?

Thread is closed for posting
2 posts, 0 answers
  1. sabarishbabu
    sabarishbabu avatar
    136 posts
    Member since:
    Apr 2009

    Posted 29 Sep 2009 Link to this post

    Hi,

    In my web application, i need to give an option to user to save the Image in his client side by selecting the drives/path and give the file name and save it  at the client side.

    Currently i am able to save it in the default path on the client side but i need to have the Dialog box open and prompt the user to choose the path and file name.

    How to do this ?  Can you explain ?


    i tried with the following code.

                System.IO.MemoryStream ms = new System.IO.MemoryStream();

                this.chartBar.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                this.Page.Response.Clear();
                this.Page.Response.ClearHeaders();
                this.Page.Response.AddHeader("Content-disposition", "attachment; filename=BarChart.png");

                this.Page.Response.AddHeader("Content-type", "image/png");
                this.Page.Response.BinaryWrite(ms.ToArray());

                this.Page.Response.End();

    In this code, i hardcoded the filename.Client Browser will give him a message for save/open etc... and if clicks on Save, it will save it to default Download location that already set by the user.



    Thanks for your valuable points






  2. Ves
    Admin
    Ves avatar
    2927 posts

    Posted 02 Oct 2009 Link to this post

    Hello sabarishbabu,

    Your code seems to be sufficient for sending the image to the client and it should open the save file dialog in IE. However, forcing the save file dialog in Firefox depends on the browser settings, see the attached image.

    Sincerely,
    Ves
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top