Murciano Posted May 10, 2010 Share Posted May 10, 2010 Hi there, i am trying to store some file data in MySQL, the data is around 1Mb in size, everytime i click to submit i get this error The requested URL's length exceeds the capacity limit for this server The MySQL field is set as BLOB and here is my php code for the action <?php $xml = $_POST['xml']; if(isset($_POST['xml'])) { $xml = ('SWFT' . base64_encode(gzcompress("$xml"))); $xml = substr($xml, 0); // UPDATE the database with the newly generated and encoded xml.gz file mysql_query("UPDATE `users` SET xml='$xml' WHERE id='$_SESSION[user_id]'") or die(mysql_error()); } ?> My question is seeing as i get the URI error with this method, how can i get the code to compress the xml to xml.gz and store it into the database as a gzipped file, any ideas? Im new to .php so any replies would have to be in a "php for dummies" kind of format, also my attached code is probably wierd so any tips on making it better would be appreciated, thanks Quote Link to comment https://forums.phpfreaks.com/topic/201248-storing-file-data-in-mysql/ Share on other sites More sharing options...
ChemicalBliss Posted May 10, 2010 Share Posted May 10, 2010 Its not mysql failing its the fact yuour trying to send a huge amount of data through a simple form field (textarea). Upload the file to the server, then read the temporary file and insert those contents. Have a look at (google): PHP Uploading Files (Lots of tutorials for Newcomers to PHP). -cb- Quote Link to comment https://forums.phpfreaks.com/topic/201248-storing-file-data-in-mysql/#findComment-1055779 Share on other sites More sharing options...
PFMaBiSmAd Posted May 10, 2010 Share Posted May 10, 2010 The error has nothing to do with the php code. It is likely your form is using the get method, rather than the post method. What is your form code? Quote Link to comment https://forums.phpfreaks.com/topic/201248-storing-file-data-in-mysql/#findComment-1055781 Share on other sites More sharing options...
Murciano Posted May 10, 2010 Author Share Posted May 10, 2010 The error has nothing to do with the php code. It is likely your form is using the get method, rather than the post method. What is your form code? Told you i was a newbie..lol, i didnt put a form method in , works ok now with post, thanks for pointing me in the right direction Quote Link to comment https://forums.phpfreaks.com/topic/201248-storing-file-data-in-mysql/#findComment-1055787 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.