How Can I use http put method to get file with its content and create this file on file system.
Example code works for Http get method.
static void helloWorldHandler(HttpRequest* pRequest, HttpResponse* pResponse)
{
printf("helloWorldHandler gets called\n");
pResponse->setStatus(HttpResponse::HTTP_STATUS_OK, "OK");
pResponse->addHeader(HttpRequest::HTTP_HEADER_CONTENT_TYPE, "text/plain");
pResponse->sendData("Hello back");
pResponse->close();
}
class HttpTask: public Task {
void run(void *data) {
ESP_LOGD("http", "Testing http ...");
HttpServer* pHttpServer = new HttpServer();
pHttpServer->addPathHandler(
HttpRequest::HTTP_METHOD_PUT,
"/helloWorld",
helloWorldHandler);
pHttpServer->start(80);
return;
}
};
Http put file example to create new/update file
Re: Http put file example to create new/update file
Thanks. appreciated. I will try this code to upload file via Http.
Who is online
Users browsing this forum: No registered users and 87 guests