Forum

AllowFileType = (file extension or MIME type)

RaGe10940
23 March 2014, 00:25
Hey Hugo,

What do you think of having a option in the Directory configuration to only allow specific file types? Like a uploads directory that only holds .csv files?

Hiawatha version:
Operating System:
Hugo Leisink
23 March 2014, 01:06
You mean, something like
UrlToolkit {
ToolkitID = allow_only_csv
Match ^/upload/.*\.csv$ Return
Match ^/upload/.* DenyAccess
}
RaGe10940
23 March 2014, 05:25
Well not a regex UrlToolKit, but like something like :

Directory {
Path = path
AllowFileType = csv
AllowFileType = txt
AllowFileType = docx
}


or something like so that but with comma separated types

AllowFileType = csv,txt,docx,xls
RaGe10940
23 March 2014, 05:37
So for example, we have a web application where users can upload images to a directory called uploads.

the directory can only have jpg and mpg (for example)

so something like AllowFileType = jpg,mpg
Hugo Leisink
23 March 2014, 08:55
UrlToolkit {
ToolkitID = restrict_access
Match ^/uploads/.*\.(jpg|mpg)$ Return
Match ^/uploads/.* DenyAccess
}
This topic has been closed.