You need to sign in to do that
Don't have an account?
zeezack
File Uploads
Hello,
I have created a web form that will allow users to insert new accounts and then attach new claims with them. So it inserts into the database the people account and then takes their unique id and attachs it to a new claim.
I now need to attach documents to each claim... is there a specific folder I can upload to, a temp folder then rename folder.
Does anyone here have any experience with this?
All Answers
here is the example from the doc
<; Page: --> <apex:page standardController="Document" extensions="documentExt"> <-- Upload a file and put it in your personal documents folder--> <apex:messages /> <apex:form id="theForm"> <apex:pageBlock> <apex:pageBlockSection> <apex:inputFile value="{!document.body}" filename="{!document.name}"/> <apex:commandButton value="save" action="{!save}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> /*** Controller ***/ public class documentExt { public documentExt(ApexPages.StandardController controller) { Document d = (Document) controller.getRecord(); d.folderid = UserInfo.getUserId(); //this puts it in My Personal Documents } }
The page should bind the input file to the body of a document or attachment. Your controller can create the attachment and then expose the attachment , then bind the input file to attachment.body .
you don't have to worry about the mime types or base 64 coding as this is done by the component.
Hello Ron,
I am building this in php. This is not an attachment to the salesforce api. I've got the form to upload a file, but usually I've only delt with uploading files...from what I can tell here, it stores the file in the database...as a binary file?