I'm trying to upload images to folders in my cloudinary account but I can't get it to work, it always saves to the default home
folder.
I have two folders in there called categories
and products
.
This is what I have right now
\Cloudinary\Uploader::upload(
$request->file('image'),
$options = array('public_id' => '/home/categories/' . $request->name . '.' .$extension)
);
I also did '/categories/' . $request->name . '.' .$extension
I get this
Cloudinary\Error
public_id (/home/categories/asdasdf.jpg) is invalid
The docs are here, I can't see what I'm doing wrong
https://cloudinary.com/documentation/image_upload_api_reference#upload_method
How can I fix this?
My Answer:
file('image'),
array("folder" => "categories")
);
I want to upload the image to the categories folder but it's not working. Can someone help me with the correct code to upload an image to a specific folder in Cloudinary using PHP?
Rate this post
5 of 5 based on 1027 votesComments