This is a migrated thread and some comments may be shown as answers.

how to show the save dialog box?

1 Answer 344 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
sabarishbabu
Top achievements
Rank 1
sabarishbabu asked on 29 Sep 2009, 01:10 PM
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






1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 02 Oct 2009, 08:04 AM
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.
Tags
Chart (Obsolete)
Asked by
sabarishbabu
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or