4 Replies Latest reply on Jun 9, 2009 4:10 PM by dzeikei

    Trying to write an XML file to disk using PHP

    jDubz_ Level 1

      Hello.

       

      I decided it's time to seek help for the issue I'm having.

       

      Say I have a photo-gallery that loads images with a caption using data from a local XML file. I want the user to be able to click on a photo to change the caption and thereby modify the XML. I then need to write the updated XML from Flex back to the local XML file. I'm actually suprised I haven't been able to find examples of this online. I've learned that security settings prevent us from writing directly to disk with Flash/Flex, so the solution I've come up with is to use PHP. Currently, Flex passes the updated XML as a string to the PHP script, and PHP overwrites the local XML file with the string.

       

      I'm having 2 issues.

       

      1. I can see on in the bin-debug folder that the modified XML file is written properly, but relaunching the application populates my TileList with the OLD data.  The weird thing is that if I delete the  XML file completely from my project (from the source and bin-debug folders), or if I change the URL in the httpService to a bogus filename, the application still runs fine with the old data. The other weird thing is that at a couple times during my troubleshooting, everything suddenly worked fine as intended. I've tried cleaning the project, and many other things I can't even remember (like changing the path to the PHP/XML files, launching the application outside of Flex Builder, changing the build path in the project settings)...

       

      Am I right to think is weird, or am I missing something really simple? Any ideas? Am I even going about it a good way to write the XML file through PHP?

       

      2. The second issue I think is less important, but I will explain it because maybe it's related to the first. Clicking on the button to call the PHP script causes the text "Transferring data from localhost..." to appear at the bottom of my browser indefinitely.

       

      Thanks in advance.