Improved image file upload

Added security & error codes