All pastes #2024505 Raw Edit

conv

public php v1 · immutable
#2024505 ·published 2010-12-20 14:59 UTC
rendered paste body
<?php$print_form=1;if( 'Upload' == $_REQUEST['action']) {    $iFile = $_FILES['ufile']['name'];    $uploaddir = "conv/";    $path = $uploaddir.$iFile;    if($iFile != none){	$print_form=0;	if(copy($_FILES['ufile']['tmp_name'], $path)){$rfile = file($path) or die ("File cannot be opened\n");    $i = 0;for ($line=10; $line<(count($rfile)-3); $line++) {    if (strlen($rfile[$line]) >= 19) {    $string[$i]=preg_split("/\s+/", $rfile[$line], -1, PREG_SPLIT_NO_EMPTY);    $i++;	}    }//print_r($string);echo "<table><tbody>";for ($k=0; $k<count($string); $k++) {	$num=$string[$k][2];	$date=$string[$k][8];	$k++;	$num=$num.str_replace('-','',$string[$k][0]);//	$date=$date.' '.$string[$k][1];	echo "<tr><td>".$num."</td><td>".$date."</td></tr>";	}	echo "<tbody></table>";        } else {    echo 'File could not be uploaded';	}    }//header('Content-type: text/plain');//header("Content-Disposition: attachment; filename=$path");//readfile($path);}if( $print_form >0 ){?><form action="" method="post" enctype="multipart/form-data"><input type="file"  name="ufile" /><input type="submit" name="action" value="Upload" /></form><?php}?>