This is unsafe unless you can keep the food at or below 4°C (39°F) until it is consumed.
There are many questions about this on the cooking subredditSE, where they have a thread devoted to proper storage of food. To quote the highest upvoted answer by Aaronut:
The USDA has this to say on it:
Storing Leftovers
One of the most common causes of foodborne illness is improper cooling of cooked foods. Because bacteria are everywhere, even after food is cooked to a safe internal temperature, they can be reintroduced to the food and then reproduce. For this reason leftovers must be put in shallow containers for quick cooling and refrigerated within 2 hours.You'll find similar statements from government agencies around the world. The safe limit for raw or cooked food is 2 hours in the danger zone (40-140°F or 4.4-60°C).