How to open file upload? (boost::beast)

398 views Asked by At

As you can take from my Title, I have no ideas on how to open a file that's uploaded via my Rest Interface. I want to work with the file in the Body of the Request.

   std::string fn = request["filename"].to_string();
   std::cout << "fn: " << fn << '\n'; // <-- is always empty
    boost::beast::error_code errorCode;
    requestParser.get().body().open("test.txt", boost::beast::file_mode::read, errorCode);
    if(errorCode){
        return server::fail(errorCode, "doRead");
    }

   // Read a request
   boost::beast::http::async_read(tcpStream, basicFlatBuffer, request, 
   boost::beast::bind_front_handler(&session::onRead, shared_from_this()));

You are my last hope StackOverflow!

0

There are 0 answers