开发者

Upload Excel or CSV file to MySQL with PHP

I'm looking to allow users to upload an Excel or CSV file to MySQL for a contact management syste开发者_如何学Pythonm. Need to be able to allow users to map their columns so that they are imported into the correct column in the table.

Anyone know of a good site or tutorial on this?


Check out "insert from infile". I haven't done anything dynamic like this, but I use it all the time for statically formatted reports.

You can read the first line of the report to map the columns.

This might help read an XLS: http://www.phpclasses.org/package/1919-PHP-Stream-wrapper-to-read-and-write-MS-Excel-files.html


I don't know of anything that you can pull off the shelf and use, but you should be able to whip something up pretty quickly.

Basically, get the uploaded file, grab the first line (use fgetcsv()). Then dynamically build a little form that displays the data from each column, associated with a dropdown to select the destination field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜