LiquidPlanner Classic Forum

Ask a Question
ANSWERED
ANSWERED
ANSWERED

What types of questions can I ask on this forum?

ANSWERED
ANSWERED

Upload Documents via API

Hello, I'm having issues uploading files up to Liquid Planner through the use of the API. In an effort to solve this, I even created a simple form that uploads a data file to a temporary file then attempts the upload by calling the API. So far I found a complete example that should work provided in this form but still seem to not be having any luck. https://developer.liquidplanner.com/discuss/5d5c31a3f2fb1d038ed1c396 Code Snip it: //https://developer.liquidplanner.com/discuss/5d5c31a3f2fb1d038ed1c396 $url = "https://app.liquidplanner.com/api/workspaces/" . $workspaceID . "/tasks/" . $taskId . "/documents"; $file = realpath($fileLocation); $data = array( "document[file_name]" => $fileName, "document[description]" => $fileDesc, "document[attached_file]" => "@".$fileLocation, ); var_dump($data); $conn = curl_init(); curl_setopt($conn, CURLOPT_HEADER, 0); curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1); curl_setopt($conn, CURLOPT_ENCODING, ""); curl_setopt($conn, CURLOPT_USERPWD, $email . ":" . $password ); curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($conn, CURLOPT_POST, true); curl_setopt($conn, CURLOPT_URL, $url); curl_setopt($conn, CURLOPT_POSTFIELDS, $data); $response = curl_exec($conn); print_r( $response."\n" ); curl_close($conn); This is what var_dump is reporting: C:\wamp64\www\EIS\LP_Success.php:88: array (size=3) 'document[file_name]' => string 'ckt2.pdf' (length=8) 'document[description]' => string 'application/pdf' (length=15) 'document[attached_file]' => string '@C:\wamp64\www\EIS\uploads\ckt2.pdf' (length=35) {"type":"Error","error":"BadArgument","message":"You must POST a document[attached_file] part when creating a document."} I even went as far as to create a submit form coupled with a process file form to try to get this to work outside of my PHP App. If you would like me to send you the full source which is 2 files I'll be happy to do so. Thanks Miguel Grajeda
ANSWERED

Who responds to posts on the new Developer Forum?

ANSWERED

Do I need an account to post on the Forum?

ANSWERED
ANSWERED
ANSWERED