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
RetreeverRetreever 

Switch from Notes/Attachments to Salesforce Files

We are trying to switch from Notes and Attachments to Salesforce Files but have run into an issue with file attachments being loaded from a web form.
Currently a person can populate the form fields, attach a file and click the submit button on the web page - this in turn creates (2) custom objects and attaches the file to one of the custom objects under the Notes and Attachments related list - this has been working for more than a year.
I have completed all of the necessary tasks in our Salesforce Sandbox to switch to files and I have a test web site connected to the sandbox org to test the form submissions. Everything comes through as described above BUT there is no "file" in the "Files" related list on the new record. I am assuming I need to change the coeding on the website but neither my web site developer or I have a clue as to what needs to change.
See below the coding which currently handles the file attachment from the web site form any help or suggestions would be greatly appreciated.
 
// CV attachment object
    $jobAttachment = null;
    $candidateAttachment = null;
    if ($cv['tmp_name']) {
        $jobAttachment = new stdClass();
        $candidateAttachment = new stdClass();

        $jobAttachment->Name = $candidateAttachment->Name = $cv['name'];
        $jobAttachment->ContentType = $candidateAttachment->ContentType = $cv['type'];
        $fileContent = base64_encode(file_get_contents($cv['tmp_name']));
        $jobAttachment->Body = $candidateAttachment->Body = $fileContent;
    }