how do i insert a picture into a database from a zend form. pls help me with the codes
No codez are found in this answer, but generally its a bad idea to put pictures in the database. Put the pictures on the filesystem (maybe named by the SHA1 hash of their contents) and put the paths to the pictures in the database.
You should never insert pictures to database. Upload them to server, store them somewhere and put a link to them to a DB. Don't put all images to the same directory. On many images this can slow access. Create some directory structure like a/b/c/image221.jpg to store them
Put the file name into a table (plus any necessary meta data), make note of the new ID. Move the file to any directory (can be outside the public root) name it the ID (without extension). Then make a render page that sets the necessary headers and renders the file using readfile(). You now have some secure files that you have full control of the access to and are effectively in a database, as required.
Check
Instead of the Upload Form suggested in the tutorial, use a Zend_Form
as described in the ZF Manual. You will also have to exchange the DB code if you want to use Zend_Db_*
. Basically, what you need to do is provide the Upload Form, receive the file and then write the binary of the file to a BLOB in the database (along with any metadata you like).