We actually want to upload a file and attach it to an item but we're having problems just uploading it.
We are having a problem uploading an image into an item. We cant seem to access the image we uploaded to Podio via the API. We get a - "Sorry, you don't have access to this file. You might want to ask your admin to provide you the access to this file."
Which is so weird because everyone in our team cant access it, and we're admins on our workspaces. I also setup the api/secret keys and i'm and admin on that workspace. Whats wrong with this?
This is the code:
Podio::setup($client_id, $client_secret);
try {
Podio::authenticate_with_app($app_id, $app_token);
$upload = PodioFile::upload('PATH_TO_FILE', 'test_image.jpg');
if( $upload != ""){
echo "<br><br>Image uploaded to podio!<br><br>";
echo "<pre>".$upload."</pre>";
echo "<br><br>".$upload->file_id."<br>";
echo $upload->link."<br>";
}
if( PodioFile::attach( $upload->file_id, array('ref_type' => 'item', 'ref_id' => 43 )) != ""){
echo "<br><br>Image attached to item!<br>";
}
}catch (PodioError $e) {
echo $e->body['error_description'];
}
Podio::set_debug(true);
43? - Pavlo - Podio[rights] => Array ( [0] => update [1] => view [2] => delete [3] => download ) [created_by] => Array( [type] => app [id] => 20352724 [avatar_type] => iconbut as said above we cant access the file in podio. we want to upload a file then attach it into an item in podio in this case item 43 was the item we want it attached to. "The app with id 20352724 does not have the right add_file on item with id 43" error log - John Penyah43is for sure not your item :) You need to find and use item_id and not app_item_id - Pavlo - Podio$upload->linkso this is the main problem, we cant even access the uploaded file thats why when we attach it, it gives the - "The app with id 20352724 does not have the right add_file on item with id 43" error, there's nothing wrong with my setup, authentication, and upload code right? @Pavlo-Podio - John Penyah