It's straight forward to handle file uploads in PHP, so an outline script whereby you have a file upload HTML form with which to upload and parse a file would be as follows:
<?php
set_time_limit(0);
require("MagicParser.php");
function myRecordHandler($record)
{
// process record as normal e.g. insert into MySQL
}
if (isset($_FILES['userfile']['tmp_name']))
{
MagicParser_parse($_FILES['userfile']['tmp_name'],"myRecordHandler","xml|FORMAT/STRING/");
}
?>
<form enctype="multipart/form-data" method="POST">
Select File:<br />
<input name="userfile" type="file" />
<input type="submit" value="Upload" />
</form>
Replace xml|FORMAT/STRING/ with the actual format of your source data, and that should get you close!
Hello Roy,
It's straight forward to handle file uploads in PHP, so an outline script whereby you have a file upload HTML form with which to upload and parse a file would be as follows:
<?php
set_time_limit(0);
require("MagicParser.php");
function myRecordHandler($record)
{
// process record as normal e.g. insert into MySQL
}
if (isset($_FILES['userfile']['tmp_name']))
{
MagicParser_parse($_FILES['userfile']['tmp_name'],"myRecordHandler","xml|FORMAT/STRING/");
}
?>
<form enctype="multipart/form-data" method="POST">
Select File:<br />
<input name="userfile" type="file" />
<input type="submit" value="Upload" />
</form>
Replace xml|FORMAT/STRING/ with the actual format of your source data, and that should get you close!
Cheers,
David
--
MagicParser.com