I am creating a chrome extension that can create a task to Podio using Podio API PHP. Also, it can attach files. This is working perfectly on localhost. But when I uploaded the php files on a live server, I get an error in PodioFile::upload
, and it says 'PodioServerError'
.
$longStringPathAndName = "url_of_image|filename_of_image,url_of_image2|filename_of_image2"
$longArrayPathAndName = explode(",", $longStringPathAndName);
/*Declare the filearray holder */
$strAttachment = array();
/*Loop for every file item */
$xx = 1;
for ($xx = 0; $xx < count($longArrayPathAndName); $xx++) {
/*split each file item according to pipe (|), to separate the filepath and filename */
$arrFile = explode("|", $longArrayPathAndName[$xx]);
/*Temporarily upload the file, place it in $file so we can get the file_id */
$file = PodioFile::upload($arrFile[0], $arrFile[1]);
/*Append the new file_id to the filearray holder */
array_push($strAttachment, $file->file_id);
}
Thank you folks! ^_^
[EDIT] November 8, 2019
I uploaded the php files on a free webhosting (000webhost) and it works! My problem is, I don't want to use this free hosting because I have already bought a hosting package in Netvirtue. Is there any restriction set by Netvirtue that makes the PodioFileUpload
unusable?
To wrap it up:
- Code has no problem, working on a localhost and a free hosting.
- Code does not work on my paid hosting (Netvirtue), I don't know if its the same on other paid hosting company. Please confirm.
- Based on this, I hypothesize that there is a setting that restrict the Podio API the direct file upload on my server.