I have a page that will allow me to upload a CSV file. Using PHP I then take the contents of the CSV file and insert them into a MySQL database. I've been doing this with no problems for awhile now. Then today, I tried uploading the file and it didn't work. The problem is that there appears to be no file type associated with the CSV file. For example, on a good upload, the debug messages I spit out look like this:
You uploaded a file: buylist_235.csv
file type: application/vnd.ms-excel
file size: 10456
File is valid, and was successfully uploaded. Here is some more debugging info:Array (
[csv] => Array
(
[name] => buylist_235.csv
[type] => application/vnd.ms-excel
[tmp_name] => C:\xampp\tmp\php3C1E.tmp
[error] => 0
[size] => 10456
)
)
However, when I upload the problem file with the debug messages on I noticed the file type and file size is empty.
You uploaded a file: buylist_235_1.csv
file type:
file size: 0
Possible file upload attack!
Here is some more debugging info:Array
(
[csv] => Array
(
[name] => buylist_235_1.csv
[type] =>
[tmp_name] =>
[error] => 2
[size] => 0
)
)
Anyone have any ideas why the file type is empty? In Windows Explorer, if I hover over either of these files the info balloon over the files say "Type: Microsoft Excel Comma Separated Values File". But there is something wrong with the second file that causes my PHP to puke and not recognize the file type.