<?php $galleryPath = "Gallery/"; $descriptions = new DOMDocument("1.0"); $descriptions->appendChild($descriptions->createElement("files")); while (($uploadedFile = UploadedFiles::fetchNext()) != null){ $sourceFile = $uploadedFile->getSourceFile(); $sourceFileName = $sourceFile->getFileName(); $descriptionsFile = $descriptions->createElement("file"); $descriptionsFile->setAttribute("name", $sourceFileName); $descriptionsFile->setAttribute("width", $sourceFile->getWidth()); $descriptionsFile->setAttribute("height", $sourceFile->getHeight()); $descriptionsFile->setAttribute("description", $uploadedFile->getDescription()); $descriptions->documentElement->appendChild($descriptionsFile); $sourceFile->save($galleryPath. "/" .$sourceFileName); } $descriptions->save("Descriptions.xml");?>