c++ - cgicc html form file upload and opening uploaded file -


i have jsp upload file works fine. after file has been uploaded trying open file again using file path saved form data.

however, filepath variable shows fine ifstream fails. if csvfilename variable set manually path + file name works fine. doing on mac , trying avoid using boost library.

form_iterator 2 = cgi.getelement("csvfilename"); csvfilename=two->getvalue(); form_iterator 3 = cgi.getelement("csvfilepath"); filepath = three->getvalue(); csvfilename.c_str(); ifstream thefile; thefile.open(csvfilename); cout << "filename is: " << csvfilename << endl; if (thefile.is_open()) {     cout << "<h1>it's working</h1>" << endl;     while ( getline (thefile,line) ) {   cout << line << '\n'; }    thefile.close(); } else  {     cout << strerror(errno) << endl; } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -