开发者

Validation of tab delimited csv file

I've a page where in I ask users to upload tab separated csv file. But how do i ensure that tab separated csv file is uploaded. I need php validation for this. Can any开发者_开发知识库one help? Thanks in advance.


Apart from the usual safety measures when handling file uploads in PHP, try to parse it as CSV; if it succeeds, it is valid. One thing you may want to watch out for is files that are too large and might make your application eat up too much memory.


By far the easiest way to do a rudimentary check would be to have them enter the column names in the first row, so you can check whether they match the columns you expect. But you'll still have to check whether the data they provide is valid...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜