Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorGKSR
     
    Hi,

    when I am trying to upload image to the desired directory, I am getting an mysql error. I am able to upload the image, but the image name is not getting stored in the database. I am able to store other fields except image name.

    Error: Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\dev\akelos\lib\AkActiveRecord\AkDbAdapters\AkMysqlDbAdapter.php on line 80

    print_r($this->params['photo']); produces the following the o/p:

    Array ( [caption] => Caption 2 [image_name] => Array ( [name] => photo-2.jpg [tmp_name] => C:\xampp\tmp\php100.tmp [size] => 27537 [type] => image/jpeg [error] => 0 ) )

    Since the 'image_name' is of varchar type, and the 'image_name' is an array(show above), its showing the above mysql error.
    How can I solve this????
    • CommentAuthorKaste
     

    hm, isn't

    $this->params['photo']['image_name']['name']
    

    what you're looking for?

    • CommentAuthorGKSR
     
    thanx kaste,

    I know that. I have set the value of image_name in my controller like this,
    $this->Photo->setAttribute('image_name', $this->params['photo']['image_name']['name']);
    Yet, its showing the same mysql error?
    • CommentAuthorGKSR
     
    OK, I got it.