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
Post a Comment