Reputation: 878
Does anyone know how to save an image into my SQLite db with Doctrine2? I already got a BLOB "pic_data" and a string "pic_type", but how do i hava to go on?
Greetings, BigTeddy
Upvotes: 0
Views: 684
Reputation: 2527
Do you really need to store the image in the DB? Can't you store it in the file system.
See Storing Images in DB - Yea or Nay? for discussion about this.
You can just append the system timestamp (see php time() function) to the filename to make it unique.
$newFilename = time().'_'.$filename;
//results in 1138618081_cake.jpg
Upvotes: 1