spring-guides / gs-uploading-files

Uploading Files :: Learn how to build a Spring application that accepts multi-part file uploads.

Home Page:http://spring.io/guides/gs/uploading-files/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Limiting the file types to upload

NitishDeshpande opened this issue · comments

What is the best way to limit the type of the file that can be uploaded? For example I want to allow users to upload *.docx and *.pdf only

Right here => https://github.com/spring-guides/gs-uploading-files/blob/master/complete/src/main/java/hello/FileUploadController.java#L44-L53

You have the opportunity to screen for what is acceptable and plug in your own rules.