New ticket fix with attachment uploading.. with updated SQL