Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request().files() in Input content filtering #91

Open
masaoliou opened this issue Jan 10, 2022 · 0 comments
Open

request().files() in Input content filtering #91

masaoliou opened this issue Jan 10, 2022 · 0 comments

Comments

@masaoliou
Copy link

client:

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();
	}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant