File upload to database |
[eluser]junaids[/eluser]
hi. there is a CI upload class that allows to upload files to a destination folder. i want to upload images to a database table. how is that be done?
[eluser]pistolPete[/eluser]
There are already plenty of threads about that topic: - http://ellislab.com/forums/viewthread/91442/ - http://ellislab.com/forums/viewthread/88585/ - http://ellislab.com/forums/viewthread/81832/ - http://ellislab.com/forums/viewthread/74780/
[eluser]junaids[/eluser]
i followed this thred http://ellislab.com/forums/viewthread/81832/ and got into an error. my code is like this Code: function do_upload() the error is Error Number: 1300 Invalid utf8 character string: '‰PNG' UPDATE `user` SET ‰PNG...and a large string of characters. the file is uploaded to the specified path. but its not updated in the Db. any idea about the error!
[eluser]junaids[/eluser]
if anybody can mark my mistake or post some other way to do the job!
[eluser]TheFuzzy0ne[/eluser]
The last line should probably be something like: Code: $this->db->update('user', array('content' => $content)); The array key specifies the name of the field under which to store the data. Hope this helps.
[eluser]junaids[/eluser]
now i get an error if i upload files larger then 1MB. DB field is longblob. also in upload config i have, Code: $config['max_size'] = '16777215'; the error is, Error Number: 1153 Got a packet bigger than 'max_allowed_packet' bytes any idea?
[eluser]Dam1an[/eluser]
There is a variable max_allowed_packets in /etc/my.cnf Increase this and restart MySQL and it should solve it It should fix the problem, but not sure if its advisable
[eluser]junaids[/eluser]
sorry to again disturb u but i cant find the folder u mentioned /etc/my.cnf
[eluser]Dam1an[/eluser]
Is this a production server, windows/UNIX, localhost on XAMPP? |
Welcome Guest, Not a member yet? Register Sign In |