I'm getting an XML response from the Amazon API

```
$dom = new DOMDocument();
$dom->loadXML($response->toXML());

```

I've tried using PHP's [filesize](http://php.net/manual/en/function.filesize.php) function, but it is not outputting anything via echo.

```
$xml1 = simplexml_load_string($dom->saveXML());
$filesize = filesize($xml1);

```

Same with trying this

```
$filesize = filesize($dom->saveXML());

```

is not outputting a filesize.

The blank xml response I'm getting is 354 bytes, so I'm trying to do something like this

```
if ($filesize > '360') {
     $file_name = "List_".time().".xml";
     file_put_contents($file_name, $dom->saveXML());
}

```

But I'm only able to get the filesize AFTER using `file_put_contents`... as such

```
      $file_name = "ListOrders_".time().".xml";
      file_put_contents($file_name, $dom->saveXML());
      $filesize = filesize($file_name);
      echo '<br />filesize: ' . $filesize . '<br />';

```

Is there anyway to check the filesize of the XML file prior to using `file_put_contents`?