file = request.getFile('fileAttachment')
FileNameMap fileNameMap = URLConnection.getFileNameMap();
def contentType = fileNameMap.getContentTypeFor(file.originalFilename)
if (contentType != 'application/pdf') {
return error
}
Monday, March 29, 2010
Checking for mimetype during a file upload
The code below will only accept files of type .pdf
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment