Nazirul Posted April 16, 2009 Share Posted April 16, 2009 Hello all i want to upload an XML file into MySQL this is the form example <form method="post" enctype="multipart/form-data"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="xmlfile" type="file" id="xmlfile"> </td> <td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> it looks like : in MySQL 6.0, we can load xml file into mysql using this code : LOAD XML LOCAL INFILE 'student.xml' INTO TABLE student_information ROWS IDENTIFIED BY '<student_information>'; so my question is, how do we upload the file and at the same time run the LOAD XML code... help me to figure it out. thanks.. Quote Link to comment Share on other sites More sharing options...
Nazirul Posted April 16, 2009 Author Share Posted April 16, 2009 b u m p Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 16, 2009 Share Posted April 16, 2009 You need to supply an actual file to the LOAD XML LOCAL INFILE ... query, which means your upload form processing code would either need to use the upoladed $_FILES['xmlfile']['tmp_name'] name (assuming that permissions will allow the mysql client library access to it) or if that does not work you would need to move/copy the uploaded file to a regular file with the correct permissions so that the mysql client can access it for the query. Quote Link to comment 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.