Problem uploading a CSV file....
Problem uploading a CSV file....
Hayes7888
Posts: 9Questions: 2Answers: 0
Hi,
I have a page to upload a CSV to and then display data after the upload.
There is a strange problem that not all CSV files are working although they appear to be identical structures, column headers etc.
Apart from the column data itself, is there a difference between these 2 files?
payments.csv works fine but payments999.csv will not upload?
upload URL is www.spruceweb.net
Cheers,
This discussion has been closed.
Answers
I don't immediately see any differences between the two files. But the problem is not with Datatables. You are getting this error in the browser's console:
Which points to this line in your ajax success function:
If you use the browser's debugger you will find when uploading payments99.csv the
jsonData
response is null. So if you look at the network inspector tool you will see that the form data is sent as CSV file:But the response is null:
You will need to debug why the server is sending a null repsonse.
Kevin
Ok, thanks
This may be bit too advanced for me to work out but I'll have a look into it
Ok,
As this line seems to be the issue, can I use a different way of doing it?
You are getting this error:
From this line:
The reason for the error is that the response data,
jsonData
, isnull
. Thenull
response is from the server. You could use an if statement to check fornull
and skip that statement if the data isnull
to stop the error. But that won't solve the problem of why the server is responding withnull
instead of the CSV data.You will need to troubleshoot the server script to find out why the response is
null
.Kevin