wec
wec

Reputation: 5

save xml file to different directory

I am looking to save an xml file to a different directory from the root using php5. any ideas?

//write to the file
$filename = $id . ".xml";
$doc->save($filename);

I want to save the file to the /xml/ directory.

Upvotes: 0

Views: 2714

Answers (1)

prodigitalson
prodigitalson

Reputation: 60413

Change the argument to $doc->save to include the path

$filename = '/xml/' . $id . ".xml";
$doc->save($filename);

Now the thing to bear in mind is that this is a filesystem path, not web URL so its literally going to save in /xml not DOCUMENT_ROOT/xml.

Upvotes: 3

Related Questions