I'm taking input from a Caldera Forms form which includes a user upload. This is returned as an array containing the file name:
["company_logo"]=>
array(1) {
[0]=>
string(73) "https://example.com/wp-content/uploads/2018/02/logo-1.png"
}
I'm using ACF to manage the data elsewhere, which effectively just provides a nice way to get and update the data.
How can I store this in the same way WordPress does? I believe WordPress handles it in a very different way than just storing a URL, as resizing takes places and ACF returns various different sizes of the images to me.
Do I need to create an attachment?
Currently I'm adding it in the following way, which does save it as expected, but just as a text string. I need it to save in the same way that WordPress/ACF saves uploaded files when uploaded via admin area.
update_user_meta( $organisation_id, 'company_logo', $data['company_logo'][0] );