So far I'm successfully uploading a test document to Salesforce. An ID is being returned with no errors.
However, I can't see the uploaded files through Salesforce itself when I view the object referred to by the ParentId field.
Why doesn't the file appear under 'Files' when viewing the Account set as the ParentId? How can I do this?
The only way I can find the document is by manually entering the returned ID into the URL in my browser.
Here are the parameters being passed with JSON and cURL:
$data = file_get_contents($_FILES['file']['tmp_name']); $base64Data = base64_encode($data); $params = array( 'Name' => $_FILES['file']['name'], 'Description' => $_POST['description'], 'ParentId' => $_POST['salesforceID'], 'Body' => $base64Data, ); $result = create_sobject("Attachment", $params, $instance_url, $access_token); // this uses the appropriate generic JSON/cURL code to make an API request
I'm thinking my understanding of the Salesforce frontend may be the issue, since I'm new to Salesforce rather than PHP/cURL. I've got create requests to various other parts of the API working fine