Download a csv-file

I’m using the Wizfi210 along with a Arduino. called my “unit”
My unit is set up as a webbserver with Adhoc to the pc.

I can connect to the unit via the pc and browse to it through the browser. So the HTTP-request/response is working just fine.

Now, I need to download a file (a small csv-file in this case) .
So i would like some help with the HTTP-response-header that should be send.
Found several different solutions on the net, but none seemed to work for me. I got close, but not all the way

Here is one of them:

Serial.println(“\n\nSending HTTP RESPONSE WITH CSV-file”);
Serial.println(“HTTP/1.1 200 OK\r\n”);
Serial.println(“Content-Type: application/CSV”); //text/plain
Serial.println(“content-disposition: attachment; filename="myfileName.csv"”);
// Serial.print(“Content-Type: text/csv”);
// Serial.print(“\r\n”);
Serial.println(“Content-Length: 1000”);
// Serial.println(“Connection: close”);
// Serial.println(“Refresh: 5”); // refresh the page automatically every 5 sec
// Serial.print(“\r”);
// Serial.print(“\n”);
// Serial.println(“Content-Type: text/csv”);
// Serial.println();

Could you please assist me with the proper HTTP-response?
I know the size of the csv-file before sending.

This is quite urgent, so please help me ASAP.

an update:
After some testing, i almost got this working:

HTTP/1.1 200 OK
Content-Description: File Transfer"
Content-Type: application/force-download
Content-Type: application/CSV
content-disposition attachment;filename=“myfile.csv”
Pragma: public
Pragma: no-cache
Content-Length: 20

The browser starts to download a file, however, the filename is not “myfile.csv”.

Any ideas why the "content-disposition attachment;filename=“myfile.csv” is not working?

Hello Hobbex

At first, I’m not good at HTTP-protocol but WizFi210/WiFi.
So, I think that you had better ask in HTTP-protocol-community.

BTW, in general, about the below issue, you need to do as below.

  1. capture the http-packets between the web server and web-browser with such a Wireshark.
  2. Analysis of the packets
  3. emulate the http-packets with WizFi210


Thanc ssekim…

i found the problem:

content-disposition attachment;filename=“myfile.csv”

a “:” is missing after disposition.
it should be:

content-disposition: attachment;filename=“myfile.csv”