I have been looking for a solution to upload files to a XForm and then attach the files to an email.
I have followed this blog http://world.episerver.com/Blogs/Anders-Hattestad/Dates/2013/1/Upload-within-Xform/ and have managed to get the upload of the files to work.
The problem is that I am not sure how to get the files that has been uploaded to the form and have them attached when sending the email.
I am trying to add a SendMail-fuction to the XForm_BeforeSubmitPostedData event in the Global.asax.cs.
Anyone who has some example code that I can look at?
If it's necessary that the file is sent as an attachment, I think it's better that you create your custom e-mail sending that is populated with the incoming data from your XForm.
If you can survice without the attachment you can add a link to the file on your webserver as an extra field inside the XForm data.
Thanks for your reply! I beleive I want the files sent as an attachment. The problem is that I am not sure how to populate my email function with the incoming data from the XForm. Any examples how to populate it? Especially how to populate it with the uploaded files. The files are now uploaded to a seperate VPP folder as in the example in the blog http://world.episerver.com/Blogs/Anders-Hattestad/Dates/2013/1/Upload-within-Xform
You can hook up to the XForm_AfterSubmitPostedData and iterate eventArgs.FormData.GetValues() that is a NameValueCollection
If I remember correctly, each value in the NameValueCollection represents a field in your XFormAdd each value to your e-mail body.
Thanks! I will try that out and see if it works.