• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

    • ⚠️ Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • ✅ Confirm that the server meets the System Requirements
    • 🔥 Check for any available Hotfix - your issue could be already reported/fixed
    • 📚 Read documentation - It will be required to Debug and understand Errors for a faster support response

How to send post to API url

makaja2

Chevereto Member
Hi, i try send upload with API, but when i use curl, it show me error:

{"status_code":400,"error":{"message":"Invalid base64 string.","code":120,"context":"Exception"},"status_txt":"Bad Request"}

I'm post with source = $_FILE[file];

And when i try with source = base64_encode($_FILE[file]); it show me Invalid file extension

Can you help me fix that.

Thanks
 
Code:
$url = 'https://likz.me/api/1/upload/?key=xxx';
$source = $_FILES["file"];
        $data = array('source' => ($source), 'format' => 'json');
        foreach($data as $key=>$value) { @$fields_string .= $key.'='.$value.'&'; }
        rtrim($fields_string,'&');

        //open connection
        $ch = curl_init();

        //set the url, number of POST vars, POST data
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_POST,count($data));
        curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

        //execute post
        $result = curl_exec($ch);
        var_dump($result);
        exit;

Please help me, thanks
This script upload work fine with remote url
 
Back
Top