So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By vadims
#76343 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]