Ajax to pass both form data and files as json for image uploading
Added handling of permissions for image upload