Possible Duplicate:
Is it better to store images in a blob or just the url?

I need to recover images from an XML file stored on a remote server and save it to my database. Not sure how I should do so though, what type of field should the image be stored in?


  • This was migrated from Stack Overflow as being a duplicate of several questions here, and closed for the same reason. There has been a lot of excellent advice already given on this topic, I encourage you to read that advice. Do a search for image on this site ;) dba.stackexchange.com/search?q=image
    – jcolebrand
    Commented Aug 15, 2011 at 23:27

2 Answers 2


You can store your images as blobs, but in practice you're usually better off storing them in the file system and just keeping the paths to the images in the database.

See: MySQL Docs: BLOB datatype


You would just store the src in a varchar field, if using php do a file get contents function and use the awesome string functions to parse the file.

  • Yeah you could. But the question is how to store the files in the database and what type of field to use. Commented Aug 15, 2011 at 23:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.