All pastes #707913 Raw Edit

Something

public text v1 · immutable
#707913 ·published 2007-09-23 12:23 UTC
rendered paste body
<?php
error_reporting( E_ALL ); ini_set( 'display_errors', 'on' );
$uploadLocation = "c:/";

   
    if (isset($_POST['submitBtn'])){



$target_path = $images/ . basename( $_FILES['upfile']['name']);

if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {
    echo "The file: ".  basename( $_FILES['upfile']['name']).
    " has been uploaded!";
} else{
    echo "There was an error uploading the file, please try again!";
}
            
    }


$file = "test.xml";

function contents($parser, $description){
    echo $description;
}

if(isset($_POST['description'])) 
$description = $_POST['description']; 
else //error

function startTag($parser, $description){
    echo "<b>";
}

function endTag($parser, $description){
    echo "</b><br />";
}

$xml_parser = xml_parser_create();

xml_set_element_handler($xml_parser, "startTag", "endTag");

xml_set_character_data_handler($xml_parser, "contents");

$fp = fopen($file, "r");

$data = fread($fp, 80000);

if(!(xml_parse($xml_parser, $description, feof($fp))))
{
    die("Error on line " . xml_get_current_line_number($xml_parser));
}

xml_parser_free($xml_parser);

fclose($fp);

?>