let fd=new FormData();
fd.append('name','myname');
fd.append('image',e.target.files[0]);
fetch('/upload',{method:'POST',body:fd});
server:
!request().files().empty() used to return true within the block if(!request().is_ready()).
Recently it started to return true within the block if(request().is_ready()).
Exactly where should the check if(!request().files().empty()) be done?
Thank you in advance!
class my_upload: public cppcms::application {
public:
void main(std::string path) {
if(!request().is_ready()) {
session().load();
if(!request().files().empty()){ //Used to be true
request().files()[0]->set_temporary_directory("/tmp/uploads");
request().files()[0]->set_memory_limit(512);
}
}
else {
if(!request().files().empty()){ //Is true now.
request().files()[0]->set_temporary_directory("/tmp/uploads");
request().files()[0]->set_memory_limit(512);
}
release_context()->submit_to_pool();
}
};
client:
server:
!request().files().empty()
used to returntrue
within the blockif(!request().is_ready())
. Recently it started to return true within the blockif(request().is_ready())
.Exactly where should the check
if(!request().files().empty())
be done?Thank you in advance!