|
Hi Tommi I want to use https://github.com/valums/file-uploader#options-of-both-fileuploader--fileuploaderbasic to sent files via XMLHttpRequest (XHR). How can I receive and save the files using tntnet and XHR? Previously I used const tnt::Multipart& mp = request.getMultipart(); etc for multipart posts. I am now testing this: <%pre> #include <fstream> #include <string> #include <cxxtools/loginit.h> #include <cxxtools/log.h> </%pre> <%args> qqfile; </%args> <%cpp> log_info("Running fileio..."); bool vboUploadedFile = false; std::string vtxFileName = qqfile; if ( vtxFileName != "" ) { vboUploadedFile = true; log_info("Uploading " + vtxFileName + "..."); // we found a uploaded file - write it to some upload-area std::ofstream out(("../../upload/" + vtxFileName).std::string::c_str()); out << request.getBody(); } if ( vboUploadedFile ) reply.out( ) << "{\"success\":true}"; else reply.out( ) << "{\"success\": false, \"reason\": \"some reason\"}"; </%cpp> and it does work but I wonder if it is the correct way to do it? (Of course it could be so much better...) I am running Linux. Thank you
|
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________ Tntnet-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tntnet-general
