-->
Page 1 of 1

esp8266 + sd card+ send to server(godaddy)

PostPosted: Thu Jun 07, 2018 5:09 am
by vadims
Hi.
I need help. I have nodemcu esp8266, sd card adapter, and i need to send csv file from sd card to server directory.
I tried to send file with different codes, but still nothing.
Please tell me how to send file from sd card to server??

I got this, it connects to server, but do not send file from sd card..
[lis] WiFiClient client;
if (client.connect("server ip", 80)) {
File myFile = SD.open("test.csv");
client.println(F("POST /http://temperaturetest.com/city/place/ HTTP/1.1 "));

client.print(F("Host: "));
client.println("server ip");
client.println(F("Connection: close"));
client.print(F("Content-Length: "));
client.println(myFile.size());
client.println();
while (myFile.available()) {
client.write(myFile.read());
}


myFile.close();
client.stop();

} [/lis]