create and download file

Posted on 2013-05-17
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 74

Expert Comment

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

Accepted Solution

Mrunal earned 350 total points
Comment Utility

Author Comment

Comment Utility
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 150 total points
Comment Utility

Sorry i cannot clearly understood your request

check whether this sample meet your need

Author Comment

Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now