Improve company productivity with a Business Account.Sign Up


create and download file

Posted on 2013-05-17
Medium Priority
Last Modified: 2013-05-25
hi, i have a page that i want when the user click on one button executes this function:

   Private Function CreateImg(ByVal sImage As String,) As System.Drawing.Bitmap

i want when the click happens execute this function and download the image file that is created to the computer of the user asking where the user want to be save.
Question by:rafaelrgl
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39175853
What is your question?
LVL 22

Accepted Solution

Mrunal earned 1400 total points
ID: 39175855

Author Comment

ID: 39175951
this works for an file on the server:

String FileName = "FileName.txt";
String FilePath = "C:/...."; //Replace this
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");

what i want is to use the function i mention above that returns an bitmap, convert to file and downloaded. this function downloads an file on the server using path, but i don't have that, i have the function that returns an bitmap.
LVL 10

Assisted Solution

by:Monica P
Monica P earned 600 total points
ID: 39176725

Sorry i cannot clearly understood your request

check whether this sample meet your need

Author Comment

ID: 39177807
i think i was not clear about what's the question, so let me try to explain, i have an webpage that on codebehind i have this function:

  Private Function CreateImg(ByVal sImage As String,) As System.Drawing.Bitmap

but it returns system.drawing.bitmap. what i want is to convert this into a file and download it to the user when the user clicks on a button, lets say:

'get the bitmap
download the image created to the user in jpg format

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

SingleRun is a tool that ensures that only one instance of an application is started, running it again brings the application to focus.
An ASP.NET Web Form User Control is not newly introduced in ASP.NET. In fact, it was an old technology yet still playing a role to generate web content, especially when we want to use it to have a better and easy way to control part of the web conte…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Watch the software video of Kernel Import PST to Office 365 tools which can easily import PST and OST files to Office 365 for bulk mailboxes. The process of migration is simple and user can map source and destination mailboxes and easily import data…

595 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question