bowerdesign
asked on
How to get php to save xml doc without prompt
Hello All
I have working script below, I am using on a local machine with php 5 installed. It work just how I want EXCEPT that it prompts on the save.... I would like it to just save without any prompt window...
Perhaps its the "header" code I am using to save... is there some other way for php to save that just does it without prompt? Thanks
Any ideas appreciated.
I have working script below, I am using on a local machine with php 5 installed. It work just how I want EXCEPT that it prompts on the save.... I would like it to just save without any prompt window...
Perhaps its the "header" code I am using to save... is there some other way for php to save that just does it without prompt? Thanks
Any ideas appreciated.
<?php //TO CALL THE XML DOCUMENT AND NAME WITH SITE INFO
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="'. 'directoryList' .'.xml"');?>
<?php
// open this directory
$myDirectory = opendir("file:///C:/evolve/");
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
// sort 'em
sort($dirArray);
// print 'em
// loop through the array of files and print them all
echo "<dirList>" ;
for($index=0; $index < $indexCount; $index++) {
if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files
print("<site>" . "$dirArray[$index]" . "</site>");
// print("<td>");
// print(filetype($dirArray[$index]));
// print("</td>");
// print("<td>");
// print(filesize($dirArray[$index]));
// print("</td>");
// print("</TR>\n");
}
}
echo "</dirList>"
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Flash can read xml from the same source as the flash itself. So what exactly are you aiming to do?
ASKER
I have a directory with multiple xml docs in it.
I want to create a page or menu that would display all the xml docs in that directory.
So I created the php script to read the directory and create an xml doc that has all the names of the files in the directory (folder).
Then flash would be looking for that xml doc with all the files listed and present them on page. But currently it will run the script, then the windows save dialog box will pop up, then the user will have to say yes, and then it will display.
Dont think flash can do it... but would be ideal if there was a way in actionscript to have it list all of the files in a local directory.
I want to create a page or menu that would display all the xml docs in that directory.
So I created the php script to read the directory and create an xml doc that has all the names of the files in the directory (folder).
Then flash would be looking for that xml doc with all the files listed and present them on page. But currently it will run the script, then the windows save dialog box will pop up, then the user will have to say yes, and then it will display.
Dont think flash can do it... but would be ideal if there was a way in actionscript to have it list all of the files in a local directory.
ASKER
Thats what I was afraid of. Dont suppose you would have any other ideas on how to list contents of a directory...? My plan was to create this xml doc and use to list in menu (flash).
???? If not no problem.