"; //$contents = "\r\n\r\n"; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if ($row == 0) { // this is the first line of the csv file // it usually contains titles of columns $num = count($data); $row++; //$contents = $contents . "\r\n\r\n" . "\r\n" . "\r\n\r\n\r\n"; } else { // this handles the rest of the lines of the csv file $num = count($data); $row++; if( filter_var($data[1], FILTER_VALIDATE_EMAIL) != false ) { if(strlen($data[0]) == 0) { $data[0] = "No Name"; } if(strlen($data[0]) > 31) { $data[0] = substr($data[0], 0, 30) . "."; } $contents = $contents . "\r\n\r\n\r\n"; } } // end ELSE } // end WHILE //$contents = $contents . "\r\n
  name email
  $data[0] $data[1]
\r\n"; $contents = $contents . "\r\n"; fclose($handle); ini_set('auto_detect_line_endings',FALSE); // Echo the files contents echo $contents; if (!$n) continue; //echo "File: $n ($s bytes)"; } // end FOREACH } // end if( !($_FILES['file']['error'] == 4) ) else { var_dump($_POST); echo "

"; var_dump($_FILES); } ?>