htmlajaxashxhandlers

Sending email with attachment using only ajax and ASHX handler (no PHP)


I managed to send emails with attachment via ASP.NET .
But if I would like to send email with attachment using only ajax and ashx handler ? How can I do?

My problem is the fact that uploading the file ( without using the ASP.NET UploadFile control ) as I can do it only in HTML or Ajax ?
Thank you!


Solution

  • AJAX and HTML components work with documents and there prospective elements. If you want to achieve File Upload there should be server side scripting require for file writing operation.

    Basically File upload system store your uploaded file into the server temp folder from there you need to copy file from your work-space directory.

    Basic for uploading file with AJAX there is simple example is here.

    https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects
    
    https://developer.mozilla.org/en-US/docs/Web/API/FormData