if (trim($_POST["cmd"])=="upload")
{
$err_corr = "Unsupported format or file corrupted";
$excel_file_size;
$excel_file = $_FILES['excel_file'];
$uploadservername=$UploadAbsPath."tmpexcel/".$_FILES['excel_file']['name'];
echo($uploadservername);
if (!is_writeable($UploadAbsPath."tmpexcel/"))
{
echo "目录不可写!"; exit;
}
else
{
echo "目录可写!";
}
if (move_uploaded_file($_FILES['excel_file']['tmp_name'], $uploadservername))
{
echo("上传成功");
}
else
{
echo("上传失败");
}
$excel_file=$uploadservername;
//if( $excel_file )
// $excel_file = $_FILES['excel_file']['tmp_name'];
if( $excel_file == '' ) fatal("No file uploaded");
$exc = new ExcelFileParser("debug.log", ABC_NO_LOG);//ABC_NO_LOG ABC_VAR_DUMP);
//echo($excel_file."|");
$style = $_POST['style'];
if( $style == 'old' )
{
$fh = @fopen ($excel_file,'rb');
if( !$fh ) fatal("No file uploaded");
if( filesize($excel_file)==0 ) fatal("No file uploaded");
$fc = fread( $fh, filesize($excel_file) );
@fclose($fh);
if( strlen($fc) fatal("Cannot read file");
$time_start = getmicrotime();
$res = $exc->ParseFromString($fc);
$time_end = getmicrotime();
}
elseif( $style == 'segment' )
{
$time_start = getmicrotime();
$res = $exc->ParseFromFile($excel_file);
$time_end = getmicrotime();
}
switch ($res) {
case 0: break;
case 1: fatal("Can't open file");
case 2: fatal("File too small to be an Excel file");
case 3: fatal("Error reading file header");
case 4: fatal("Error reading file");
case 5: fatal("This is not an Excel file or file stored in Excel case 6: fatal("File corrupted");
case 7: fatal("No Excel data found in file");
case 8: fatal("Unsupported file version");
default:
fatal("Unknown error");
}
/*
print '
'; <br>print_r( $exc ); <br>print '
';
exit;
*/
show_time();
echo
Legend: