Skip to main content

PHP errors when using basic.php example



  • Alexandros Binopoulos

    *Note: cloudinary_php require PHP 5.3*



  • Itay Taragano

    Hi Alexandros ,

    If you're using PHP 5.2, we have our PHP 5.2 branch:

    Please let me know if this works for you.

  • Hans Halim


    I use PHP 5.2 and i have download from you link above, the Cloudinary API for PHP 5.2.

    Yet i still confused how to use it. This is my code, could you please take a look and edit it, as it still error.


    require (DIR_FS_INCLUDE . "/cloudbinary/src/Cloudinary.php");

            require (DIR_FS_INCLUDE . "/cloudbinary/src/Uploader.php");

            require (DIR_FS_INCLUDE . "/cloudbinary/src/Api.php");



      "cloud_name" => "sample",

      "api_key" => "874837483274837",

      "api_secret" => "a676b67565c6767a6767d6767f676fe1"


            $ext = $fullname[count($fullname)-1];

            $newname = $_POST['Name'].date('YmdHis').'.'.$ext;

            $newname = str_replace(' ', '_', $newname);


            $file = DIR_FS_TEMP.'/upload/employment/'.$newname;



    The error is

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\www\scorplocal\include\process_post_values.php on line 634

    Parse error: parse error in C:\www\scorplocal\include\process_post_values.php on line 634




  • Itay Taragano

    Notice that the usage might be slightly different for the 5.2 branch. Specifically, you'll need to use  CloudinaryUploader  instead of  Cloudinary\Uploader .


    Also, please note that your account's api_secret should be not be revealed. Please go to your  Security settings page in order to generate a new pair of api key and secret.

  • Hans Halim

    Hi Itay,


    Thanks for your reply. in the last few weeks, i did not have much time to touch this project. and now, when i back i tried to download your example, but i dont know how to use it.

    i try to create a simple php code, to call the test_upload fuction. yet, i think is not working. below is the code

    error_reporting(E_ALL | E_STRICT);


    $test = new UploaderTest();



    every time i run that code, there are no respond, no error message as well.


    So, could you please give me a full example code(not just the class). that i can use to upload an image.





  • Itay Taragano

    Please note that UploaderTest.php is a unit test meant to be run with PHPUnit. It was shared just for code syntax clarification purposes.

    I believe you may try to use the exact same code you shared initially, but change Cloudinary\Uploader::upload($file); to be CloudinaryUploader::upload($file);

  • Hans Halim


    Thanks for your reply. i just try to create this code, and when i tried, it sill not working.

    error_reporting(E_ALL | E_STRICT);

    $base = realpath(dirname(__FILE__).'/../');

    require_once($base . DIRECTORY_SEPARATOR . 'src/Cloudinary.php');

    require_once($base . DIRECTORY_SEPARATOR . 'src/Uploader.php');

    $result = CloudinaryUploader::upload("logo.png");



    and, in which file i need to declare my API key and secret, in which part.



  • Itay Taragano

    The account's credentials should be either included in your php file or include an external settings file, as demonstrated in our PHP sample project:

    For more information:

    If you still require further assistance, please  open a support ticket so we can further get to the root of this issue.


Post is closed for comments.