drop() is a p5.js element method that registers a callback every time a file is loaded into the element. The uploaded file is created into a p5.File class. You can use the drop() callback to check the file type, then write conditional statements responding to the file type.
Image Drop by p5.js Contributors and the Processing Foundation is licensed under CC BY-NC-SA 4.0.