A building under demolition in midtown partially collapsed Wednesday afternoon after the floor gave out under a worker using a bobcat, authorities said.

The worker was on the third floor of the building, 642 57th Street, at about 2:30 p.m. when the floors collapsed one on top of the other, according to an FDNY spokesman and a Department of Buildings spokesman. A worker who suffered serious, but not life threatening injuries was taken to an area hospital.

All other construction workers were accounted for, police said.

A violation for failure to carry out demolition operations in a safe manor was issued on Wednesday, said Buildings Spokesman Alexander Schnell.

A complaint against the building was filed with the city’s Department of Buildings in 2003 for construction that caused it to vibrate and shift to one side.