What data type to use in MySQL to store images?

前端 未结 3 1492
攒了一身酷
攒了一身酷 2020-12-09 01:36

I need to store image and resume of user in the data base.

I am using mysql data base and php5. I need to know which data types I should use.

And also how do

相关标签:
3条回答
  • 2020-12-09 02:03

    Perfect answer for your question can be found on MYSQL site itself.refer their manual(without using PHP)

    http://forums.mysql.com/read.php?20,17671,27914

    According to them use LONGBLOB datatype. with that you can only store images less than 1MB only by default,although it can be changed by editing server config file.i would also recommend using MySQL workBench for ease of database management

    0 讨论(0)
  • 2020-12-09 02:04

    What you need, according to your comments, is a 'BLOB' (Binary Large OBject) for both image and resume.

    0 讨论(0)
  • 2020-12-09 02:15

    This can be done from the command line. This will create a column for your image with a NOT NULL property.

    CREATE TABLE `test`.`pic` (
    `idpic` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    `caption` VARCHAR(45) NOT NULL,
    `img` LONGBLOB NOT NULL,
    PRIMARY KEY(`idpic`)
    )
    TYPE = InnoDB; 
    

    From here

    0 讨论(0)
提交回复
热议问题