Check file uploaded is in csv format

2019-01-30 06:41发布

I am uploading a file in php and only want to upload it if it's a csv file. I believe my syntax is right for the content type. It always goes to else statement when it's a csv file. What I am doing wrong here?

if (($_FILES["file"]["type"] == "text/csv"))
{

}
else
{

}

If I change the content type it works for that format just not csv.

7条回答
冷血范
2楼-- · 2019-01-30 07:09

simple use "accept" and "required" in and avoiding so much typical and unwanted coding.

查看更多
登录 后发表回答