Fix bug in file upload in insert hook