we want to create Contact us page in our website to post contact details from web page to Salesforce and create contact with details just like standard functionality of webtolead. We are able to create contact from web page but also we want to post Attachment as well.

Can anyone please help me how to post attachment from web form Force.com Vf page and how to accept this attachment in Apex controller .Thanks


The apex:inputFile element is what you need. There is sample code here:


But a much more complete and probably more relevant example to your use case is here:


In summary, you create a Document exposed by your custom controller and bind your apex:inputFile to that Document


You can use apex:inputFile tag in vf page for this feature.Click here for reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.