Heren kan iemand mij helpen met het volgende!

Ik wil mijn data die ingelezen is, dmv een submit button onderaan de pagina , naar mijn database sturen(INSERT).

<?php
# Check if extention and MIME type is correct
# Array with permitted types.
$aType = array('.xml',);
# Array with permitted MIME types.
$aMime = array('text/xml',);
# Extension of the selected file.
$sExtension = strtolower(substr($_FILES['file']['name'], -4));

# Check if file is permitted.
if(!in_array($sExtension, $aType)) {
# Check for valid file.
echo 'An error has been occured while choosing your file.<br />';
echo 'Please choose a correct file.<br /><br />';
echo '<a href="index.php?page=application">Go Back....</a>';
} else {
# Check for valid MIME type.
if(!in_array($_FILES['file']['type'], $aMime)) {
# MIME type is not valid.
echo 'This is not an valid file.';
} else {
// Open selected XML
$xml = simplexml_load_file($_FILES['file']['tmp_name']);
$arr = array();
foreach($xml->point as $val) {
$rMonitoring[] = array(
'stplnr' => (int)$val->stplnr,
'errornr' => (int)$val->errornr,
'cyclusnr' => (int)$val->cyclusnr,
'pointnr' => (string)$val->pointnr,
'date' => (string)$val->date,
'time' => (string)$val->time,
'posX' => (float)$val->posX,
'posY' => (float)$val->posY,
'posZ' => (float)$val->posZ,
'stplX' => (float)$val->stplX,
'stplY' => (float)$val->stplY,
'stplZ' => (float)$val->stplZ);
}
// Dump variables en print to screen.
//var_dump($rMonitoring);
echo 'There are '.count($rMonitoring).' points measured in this baseline assesment.<br />';
echo 'When these results are good please insert them into the database on the bottom of this page.<br /><br />';
// Show XML results in table for first check before stored in database.
echo '<table>';
echo '<tr>';
echo '<th>Point Nr</th><th>Point Date</th><th>Point Time</th><th>Position X</th><th>Position Y</th><th>Position Z</th>';
echo '<th>Equipment Id</th><th>Cyclus Nr</th><th>Error Nr</th><th>Station X</th><th>Station Y</th><th>Station Z</th>';
echo '</tr>';
foreach ($xml->point as $point) {
echo '<tr>';
echo '<td>'.$point->point_nr.'</td><td>'.$point->point_date.'</td><td>'.$point->point_time.'</td><td>'.$point->posX.'</td><td>'.$point->posY.'</td><td>'.$point->posZ.'</td>';
echo '<td>'.$point->equip_id.'</td><td>'.$point->cyclus_nr.'</td><td>'.$point->error_nr.'</td><td>'.$point->stationX.'</td><td>'.$point->stationY.'</td><td>'.$point->stationZ.'</td>';
}
echo '</tr></th>';
echo '</table>';
echo '<br />';
echo '<form method="post">';
echo '<input type="submit" value="Send this data to the Database."></input><br />';
}
}
?>
Nee, de oplossing die San aangeeft werkt niet. Als je een bestand upload in een scipt moet je daar iets mee doen. In jouw geval verplaatsen naar ergens waar je bij kunt en dan het pad + bestandsnaam opslaan in een sessievar.
Uploaded files worden automatisch verwijderd als het script klaar is.
Kom eens met een concreet script voorbeeld als jullie goed weten dit op te lossen
want ik krijg het niet voor mekaar , staar me kapot hahaha :)

Reageren