c++ - How to save poco uploaded file -


i want upload file using poco library.

now have uploaded file in istream variable don't know how can save file?

here code can length of file.

void handlepart(const messageheader &header, std::istream &stream) {     _type = header.get("content-type", "(unspecified)");      if (header.has("content-disposition")) {          std::string disp;         namevaluecollection params;         messageheader::splitparameters(header["content-disposition"], disp, params);          _name = params.get("name", "(unnamed)");         _filename = params.get("filename", "(unnamed)");     }      countinginputstream istr(stream);     nulloutputstream ostr;     streamcopier::copystream(istr, ostr);     _length = istr.chars();   } 

also it's 1 file uploaded in form if there more 1 file how managed in istream?

now there 2 days i'm searching , testing different ways couldn't find way, please resolve problem.

thank in advanced.

depend on #abhinav question on post:

we can write save code this:

if (filename.length() != 0){          std::ofstream fout( filename, std::ios::binary);         filelist.push_back(filename);         fout << stream.rdbuf() ;           fout.close();     } 

but unfortunately it's working 1 file if there more 1 code can't catch correctly.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -