php - Upload image name issue when share the social sites Upload plugin in Cakephp 2.x -
i told image upload plugin version cakephp2.x not cakephp3.x
i using upload plugin image upload in cakephp2.x. nice plugin.
https://github.com/szajbus/uploadpack
problem:
if upload image name koala - animal.jpg
plugin stored name <id>_koala - animal.jpg
when share image social site.
image not sharing social site due (image name)space issue.
so want store image name <id>_koala_-_animal.jpg
i found solutions after 1 , half days:
add following code in following file
upload\model\behavior\uploadbehavior.php public function beforesave(model $model,$options=array()) { //existing code /*fixes code before "return true;" start*/ if(isset($model->data[$model->alias][$field])){ $model->data[$model->alias][$field] = str_replace(' ','_',$model->data[$model->alias][$field]); } /*fixes code before "return true;" end*/ return true; }
Comments
Post a Comment