RE: Attaching uploaded file to email in portlet

John Cressman, modified 6 Years ago. Junior Member Posts: 39 Join Date: 8/15/17 Recent Posts
I am working on another portlet is basically a form with 20 or so fields.  One of them is a file upload field.  I know how to access the form fields on the backend and generate a body with those values BUT, I'm unsure how to attach the file.  

Optimally, I want to attach the uploaded file directly, without saving it but I'm unsure how to do that.

Can that be done?  If so, can someone point me to any example code?

​​​​​​​Thank you!
thumbnail
Ketan Savaliya, modified 6 Years ago. Regular Member Posts: 117 Join Date: 3/3/11 Recent Posts
Hi John,

Yes, you can do it by creating just temp file from request. 
Then just attached that temp file into mail. That's it.


Thank you!!
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
John Cressman
Can that be done?  If so, can someone point me to any example code?
No pun intended, just a great opportunity to link this great repository of knowledge ;)