Hofmeister Posted June 15, 2007 Share Posted June 15, 2007 I have a personal website with a mp3 player on it that uses a xml file to create a playlist. I am using a Flash object and javascript for the uploader (progress bar). Anyways my problem is I am using $_POST to get the variables from the flash form to the php script which works just fine for one song. If I upload another song all previous uploads, song name(s) and artist(s) are replaced by the most recent $_POST. I have the script written so it will rewrite the xml file entirely to update it, as I have a delete file script as well. I need to somehow find a way to either link the file to the fash variables previously posted or a script to create a log.txt flat file database to assign them with arrays. Basiclly I have it writing <title>".str_replace(".mp3","",$song)."</title>\n <creator>".str_replace(".mp3","",$artist)."</creator>\n this is how the mp3 player reads the xml correctly...where $song = $_POST["song"]; $artist = $_POST["artist"]; from the flash form. Anything will help...or maybe a way I haven't thought of to make it eaiser...perhaps with a sessionkey or something. THANKS! Quote Link to comment https://forums.phpfreaks.com/topic/55685-flash-uploader-using-php-to-write-xml-filehelp/ Share on other sites More sharing options...
trq Posted June 15, 2007 Share Posted June 15, 2007 You want to add a new element to the xml file, not rewrite the entire file each time. Take a look at the simplexml extension. Quote Link to comment https://forums.phpfreaks.com/topic/55685-flash-uploader-using-php-to-write-xml-filehelp/#findComment-275143 Share on other sites More sharing options...
Hofmeister Posted June 15, 2007 Author Share Posted June 15, 2007 I've considered that but I would rather not not because if I use the delete script then I will have a song on my playlist that will not have a file to play as it will have been deleted..unless I could write the delete script to delete the text in the xml file? Quote Link to comment https://forums.phpfreaks.com/topic/55685-flash-uploader-using-php-to-write-xml-filehelp/#findComment-275146 Share on other sites More sharing options...
trq Posted June 15, 2007 Share Posted June 15, 2007 unless I could write the delete script to delete the text in the xml file? Is that a question? Quote Link to comment https://forums.phpfreaks.com/topic/55685-flash-uploader-using-php-to-write-xml-filehelp/#findComment-275151 Share on other sites More sharing options...
Hofmeister Posted June 15, 2007 Author Share Posted June 15, 2007 Well yes i guess...I am just trying to think of the best route to take. I don't exactly know how to write that. Right now I have a script that will list files in my upload dir and I have a link to delete them, I don't know how I could use php to find the information for that file and delete it in the xml file while keeping it in structure for the mp3 player to read. However, I just had another thought but don't know where to go with it. If I could get some feedback on if it could work and how. When I upload the file it is then moved and renamed with php. From there could I assign the form variables into the file name and somehow have php break down the file name to write the xml? For example have it renames an uploaded song from the tmp_file (music.mp3 or what ever the tmp_name is) to (music.mp3.$_POST[songname].$_POST[artistname]) Then use a string replace or assign them a variable somehow? That's where I'm not sure. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/55685-flash-uploader-using-php-to-write-xml-filehelp/#findComment-275158 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.