Your main problem is centered around your use of SimpleXML, I don't think you've fully grasped it yet.
With the XML document provided, when the SimpleXML document is parsed (using your simplexml_load_string) the object is created which represents your XML data. In this case, the $file variable is essentially the <desc ... /> node in the form of a PHP object. If we were to take a look at the object (using print_r($file)) here's what we would see:
Because it is that node (the "root node" in XML terminology), you can't access the desc by trying $file->desc! To put it simply and hopefully in a straightforward way, you would need to use $file['@attributes']['pic'] to get a hold of the pic attribute.
With more than one description you'd need to lay out the XML document like I suggested above and then go back to looping through the descs (or pics) looking for the right id (there are other ways, but it's probably best to keep things simple for now).