Maths RkBala Maths RkBala - 1 year ago 87
PHP Question

Upload image name issue when share the social sites Upload plugin in Cakephp 2.x

I am told about Image upload plugin version for cakephp2.x not the cakephp3.x

I am using Upload plugin for image upload in cakephp2.x. It is a nice plugin.


If upload image name like

Koala - animal.jpg
plugin stored the name as
<id>_Koala - animal.jpg

When we share the image to social site.

Image is not sharing the social site due to (image name)space issue.

So I want store the image name like

Answer Source

I found the solutions after one and half days:

Add the following code in the following file


public function beforeSave(Model $model,$options=array()) {

    //Existing code

    /*Fixes code before "return true;" start*/
        $model->data[$model->alias][$field] = str_replace(' ','_',$model->data[$model->alias][$field]);
    /*Fixes code before "return true;" End*/

    return true;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download