This content has been marked as final. Show 7 replies
What you'll need to do is load the XML into a text editor type component (like TextArea or RichTextEditor). Then, when the user is done, you upload the contents of that component to the server, and the server saves it as a file. You can't create files locally on the client for security reasons.
This page has some examples in PHP on how to create files from Flex input:
Thanks for your answer. I looked at this example but it uploads a file that user selects. I needs to save a XML object from inside Flex to the server as a file. Because not experienced in PHP, I am wondering is there any example or instruction about the PHP part, particularly in converting a Flex XML object to a file in a remote server. I looked around on the page you gave but couldn't find.
Thank you very much for your help! I just have two questions:
YOu wrote "Folder php needs to be set to 777". What does this actually mean? I don't know much about php. Should the php code be compiled or just upload it there?
Files and directories in Unix may have three types of permissions: read (`r'), write (`w'), and execute (`x'). Each permission may be `on' or `off' for each of three categories of users: the file or directory owner; other people in the same group as the owner; and all others.
1. Upload everything to your web server.
2. Go to flex-php-xml/, you'll see "php" folder and some other files.
3. By default PHP can NOT write files to your web server. You need to change "php" folder permision to ('w')
4.Now php can write files into this folder.
5.Xml file is saved in "php" folder.
saveXML.php is ready to go, you don't compile anything.
If you need more info about changing file/folder permision, google "Change dir permissions (chmod)".
Thanks again. It works great for me, when I created a new project and then used your code and modified it. However, if I just simply use your project (import it), I got error when saving:
unable to open "project folder\src\libs"
I usually don't put code in the src folder. So this might be the reason I don't understand the error. Should I move your libs folder into the src folder? If not, how can I get rid of this error?
Sorry for delay. Flex Builder 3 by default put all files in 'src' folder.
Copy file 'FlexPHPXML.mxml' and 'php' folder to your 'root' folder.
So basically you just need 2 files FlexPHPXML.mxml and saveXML.php.
Hope it works