now files are deleted on error. Server side check for file type and size