Import excel files with image in php/mysql

后端 未结 3 1417
深忆病人
深忆病人 2021-01-02 14:17

I want to make an import script which allows users to upload their excel file (extension not important) to my php application.

The application should reconize a lis

3条回答
  •  被撕碎了的回忆
    2021-01-02 14:53

    To import data from Excel (or any other program that can produce a text file) is very simple using the LOAD DATA command from the MySQL Command prompt.

    1) Save your Excel data as a csv file (In Excel 2007 using Save As) Check the saved file using a text editor such as Notepad to see what it actually looks like, i.e. what delimiter was used etc.

    2) LOAD DATA LOCAL INFILE ‘C:\temp\yourfile.csv’ INTO TABLE database.table FIELDS TERMINATED BY ‘;’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\r\n’ (field1, field2);

    3) To store image to have to use TO_BASE64

    Done!

    Reference

提交回复
热议问题