I'm trying to send files with WebBrowsersComponent to Node.js server.
I need to use WebBrowsersComponent since I need to create a session with the server (which involve keeping a cookie)
, so I use it with goToURL function . my function on the client side :
void MyClasst::uploadFile(File& file){
const String& fileData = String("data=") + file.loadFileAsString();
void* ptrData = (void*)fileData.toRawUTF8();
MemoryBlock block(ptrData, fileData.getNumBytesAsUTF8());
StringArray headers(String("fileName: ")+file.getFileName());
m_WebBrowser.goToURL(UPLOAD_FILE_URL,&headers, &block);
}
in the node side , I try to print the request body, but it keeps give me empty objects . as if no data was sent.
app.post('/uploadFileNotForm',FileHandler.uploadFileNotForm);
and:
uploadFileNotForm : function(req,res){
console.log(req.body);
}
after many attemps , I see the the request does being redirected to the right function , but without the right headers and without the POST data (it printd req.body as '{}') . is something wrong with my client code?