Event in zFTPServer:
BeforeUpload
Script in zFTPServer:
C:\Scripts\CheckFileType.bat "%LOCAL_FILENAME%"
Error message in zFTPServer:
Access denied
Contents of file "C:\Scripts\CheckFileType.bat":
@echo off
rem Extract file information and remove quotes
set FILE=%1
for /f "useback tokens=*" %%a in ('%FILE%') do set FILE=%%~a
rem Only allow uploading of certain file extensions
if /I "%FILE:~-4%" == ".jpg" exit 0
if /I "%FILE:~-4%" == ".gif" exit 0
if /I "%FILE:~-4%" == ".tif" exit 0
if /I "%FILE:~-4%" == ".pdf" exit 0
if /I "%FILE:~-4%" == ".php" exit 0
if /I "%FILE:~-4%" == ".css" exit 0
rem Nothing else is allowed
exit 1