I think Gavin is right. Without the quotes
fileName.png will be interpreted by perl (grudgingly -- there is a warning, but
it is probably only placed in the apache error log) as the string
"fileName" concatenated with the string "png" so you
get fileNamepng and then WeBWorK will try to attach a .png or .gif
extension onto that name (since it doesn't have an extension).
Your reported error message seems consistent with that scenario (notice how the filename was mangled).
My guess at any rate --- predicting perl's reaction to
unusual expressions is an amusing by challenging pastime.