I would like to send a CSV file via POST in a XMLHttpRequest, but I am unsure of two things. First is there anything to distinguish a CSV file from a string split up by comma's? And what sort of Content-Type am I supposed to put in to the
A CSV is, well, a string separated by commas. Trying to separate if there is meaningful data in string as CSV as opposed to
A CSV is, well, a string separated by commas is the job for a parser and part of the reason richer data formats (XML, JSON) are often used.
This gets even more fun when you have different flavors of CSV format (line endings, header row, jagged array, muli-line strings in a single field, how to handle a
", etc...). All of these things make CSV difficult to work with as there is no standard.
The closet thing to a standard would be RFC 4180 (this also specifies the mime type as
text/csv which is the other part of your question).