Variable within an array does not work

1

is a CLOUDINARY image upload system.

When I use assign a fixed value to the PUBLIC_ID, it works!

$files["remote"] = \Cloudinary\Uploader::upload($sample_paths["couple"],
array_merge($default_upload_options, array(
  "public_id" => '8273',
))

However, when I use a variable for the PUBLIC_ID, the result of PUBLIC_ID is simply NULL

$files["remote"] = \Cloudinary\Uploader::upload($sample_paths["couple"],
array_merge($default_upload_options, array(
  "public_id" => "$idbusca",
))

What can it be?

    
asked by anonymous 18.01.2017 / 23:18

1 answer

0

Friend first in

$files["remote"] = \Cloudinary\Uploader::upload($sample_paths["couple"],
array_merge($default_upload_options, array(
  "public_id" => "$idbusca",
))

Remove double quotes ( ") around the $idbusca variable.

After this verify that this variable is not really empty / null can be this way

echo 'Var $idbusca:<br/><pre>';
var_dump($idbusca);
echo '</pre>';

$files["remote"] = \Cloudinary\Uploader::upload($sample_paths["couple"],
array_merge($default_upload_options, array(
  "public_id" => $idbusca,
))

Because of the way it is there it should return the value correctly. If it really is empty, the ideal is to go through the code by checking how far it has the information and where it "lost."

    
18.01.2017 / 23:32