Murciano Posted May 11, 2010 Share Posted May 11, 2010 I have a script on my server that downloads, decompresses and decodes gzipped xml data for editing in a textarea, after editing i am base64 encoding and gzcompressing this xml data to save in MySQL this is the code that i use <?php if(isset($_POST['submit'])){ $xml = $_POST['xml']; $xml = ('SWFT' . base64_encode(gzcompress("$xml"))); $xml = substr($xml, 0); mysql_query("UPDATE users SET xml='$xml' WHERE id='$_SESSION[user_id]'"); $result = mysql_query($query); } ?> as you can guess it just saves the data as an encoded text to make it work as a gzipped file it needs echoing in a textarea and pasting into notepad (or similar ) and saved manualy as an xml.gz file What i am trying to get around is having to do the notepad thinggy, how can i get it to save the file and store in the db in a BLOB filed as a xml.gz i know this is the way to go http://www.bigresource.com/Tracker/Track-mysql-Bm92u4gR/ but how can i assign it a name whilst encoding/compressing and updating into MySQL at the same time? Link to comment https://forums.phpfreaks.com/topic/201406-save-gzcompressed-file-into-mysql-field/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.