function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ganesh HegdeGanesh Hegde 

Upload file to salesforce from java application


I have a log file in my system. I need to upload that file to salesforce and then send an email to client by attaching that file. Please suggest me the approach to do this. Also,the file should be stored in salesforce

Hello Ganesh,
As per your question,We have an approach saying 
1.Read the complete file using Inputfile tag.
2.In the Apex Class,after reading save it in attachment of particular object and
3.Query the same attachment object.If the attachment size is greater than zero.
4.Take the body of attachment.
5.Use Mail and Attach Objects and send an email.

Please go through the above steps and get the solution.If you get any problem please reply me.
If you get the solution please mark as a Best Answer.
Many Regards

Iqrar AhmedIqrar Ahmed
Hi Ganesh,
First upload your file ito feed item in salesforce chatter and then write a trigger on insert of feed item and use messaging class to send email to client.

Best Regards