I do not think that it is legal for a dump truck to hold garbage for more than two days. The more the garbage stays in a confined place, the more it continues to decompose and this causes a lot of smell to come from it, which is a health risk. You should find out from your city regulations, how long a truck is allowed to hold garbage.
No it is illegal, you can complaint to civic authority and health department. The owner of the garbage truck or those under whose contract the truck is working will automatically be penalized and their licence will be cancelled or even the truck will be seized.