Watch a previous NBC4 report on Justin Foley in the video player above.

COLUMBUS, Ohio (WCMH) — A former Columbus City Schools teacher has pleaded guilty to allegedly creating pornographic material involving some of his students.

Justin Foley, 47, plead guilty to sexually exploiting minors and possessing child photography, federal court documents showed. Foley worked in Columbus area schools since 2013 and was an AP chemistry teacher at Columbus Alternative High School. He resigned on Oct. 5, one day after the district began the process of firing him.

Foley allegedly used his cell phone and other digital devices to create pornographic material, according to court documents. During questioning by Delaware police, Foley allegedly admitted to recording videos up the skirts and shorts of some of his students. The U.S. Attorney’s office also said Foley possessed tens of thousands of explicit videos of students at school, allegedly filming videos both in dressing rooms and other public places.

Delaware police said they received a tip on Aug. 16 from the National Center for Missing and Exploited Children with an IP address from Delaware County and an email account containing apparent child pornography. Later, police said they had enough evidence to trace the account back to Foley and execute a search warrant in his home.

Federal officials said the videos found on Foley’s electronics appear to have been recorded at the school, at central Ohio department stores, in public areas in Delaware, and in dressing rooms.

Sexually exploiting a minor is punishable by 15 to 30 years in prison, while distribution and receipt of child pornography is punishable by five to 20 years in prison.