Although mime-types can also be tricked (edit the first few bytes of a file and modify the magic numbers) but it's harder than editing a filename.
if you are dealing with a video file then replace the image check with a video check in the if block..
have fun $_FILES['field_name']['type'] is a user defined and therefore should not be relied upon for validation.
String Joiner; @Controller public class Upload Controller //...
Redirect Attributes; @Controller Advice public class Global Exception Handler project $ mvn jetty:run //...