Paste image from clip board to send via e-mail

B

Ben

Hi,

I am writing an aspx page which submits data via and e-mail. I want to allow
a user to paste and image from the clipboard (screen dump for example) and
then this image must either be saved to a database file or insterted in the
e-mail and sent (preferable method).

Any and all help to pointing me in the right direction is appreciated.

Ben.
 
G

Guest

To get the file to the web server, use a HtmlFileInput control. In your aspx
page, put this:

<input type="file" runat="server" id="fileUploadControl">

Which should create this line in your code behind:

protected System.Web.UI.HtmlControls.HtmlInputFile fileUploadControl;

So, in your Page_Load (or somewhere else in code behind) you can do this:

if(Page.IsPostBack)
{
fileUploadControl.PostedFile.SaveAs(@"C:\test.txt");
}

Now you have the file and you can do whatever you want with it. There are
also other methods on the PostedFile property to get the stream and do other
things, if saving to the web server is not what you want to do.

Hope this helps.
 
K

Kevin Spencer

Unless you want to write a client-side ActiveX control or Java applet to do
this, it would be more easy to have the user save the image as a file and
then upload it with a FileUpload Control.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top