How to Upload image in Suitecrm 7.10

I just want to upload a image to upload folder through code in Suitecrm …
thank you…

Why not just copy the file into the folder?

What else do you need, do you need it in some way connected to a CRM record?

Thank you,
I can not copy image to upload folder because I am uploading an image through rest Api . Actually I am creating a product record through Api and I have to save the image in upload folder.
I am passing arguments like that----

    [session] => 8rjer0dhbr1to1jaj7n5rsvb0i
    [module_name] => AOS_Products
    [name_value_list] => Array
            [0] => Array
                    [0] => Array
                            [name] => name
                            [value] => David
                    [1] => Array
                            [name] => product_image
                            [value] => /home/user/Downloads/zombie-7531835 (1).jpg

So at the product_image field I have to give the path like –
http://localhost/suitecrm_v/upload/zombie-7531835 (1).jpg”
That’s why i want to upload image to upload folder.

It’s possible that there is a way of uploading the image through the API, but I don’t know how to do it.

You could just send it over with some method of remote copy (ssh, scp, rsync, …) and then join things together from PHP on the destination server.

Okhai thank you I will try :slightly_smiling_face:

If you are a developer, one way is to create a bean of type ‘Notes’. In it, you have to set some values, for example:

$imagen->file_mime_type = 'image/jpeg';
$imagen->filename = 'Name.jpg';
$imagen->name = 'Name that will be displayed as a link to download';

$idImagen = $imagen->save();

After saving the ID of that bean in the $idImagen variable, you have to save the image in the directory: /upload/$idImagen

Then, the Notes bean will point to the image you want and you can relate it to any record in a module.
I hope this helps.

1 Like

More on that here:

How i have to define $imagen variable?
thank you.

Well, as I had mentioned to you, the alternative is to create a bean of type “Notes”. Therefore, it would be like this:


$imagen = BeanFactory::newBean('Notes');