I have a problem: I need to read file from post param in ChicagoBoss. I'm trying:
upload_file('POST', []) ->
File = Req:post_param("file"),
{ok,Data} = file:read_file(File),
And have an error:
{{badmatch,{error,enoent}}
When I'm trying to check the file like:
case filelib:is_file(File) of
true -> {output, "ok"};
false -> {output, "error"}
end.
I have error output.
I'm trying to upload file with Postman. Where is the problem?
What's inside
Req:post_param("file")?You assume it's a path to a file: have you checked the value of
File?Anyway, it's
Req:post_files/0you are probably looking for:It's also probably a Bad Idea to leave the file at it's temperory location, you'd better find a more suitable place to store them.