addFromFile expects the *name* of the file. Because you already have the *contents* of the file, you should change method. Maybe addFromString is the correct one, but I'm not sure.
"g.addFromString(fileContent);" It works now. Thanks Lodovico and llmp!