fixed whitespace in filename bug // return json when requested with ajax