示例#1
0
function import($option)
{
    global $database, $my;
    $file = file($_FILES['import_file']['tmp_name']);
    $catid = mosGetParam($_POST, 'import_catid');
    $type = mosGetParam($_POST, 'import_type');
    //***********************   begin add for XML format   ***************************************/
    switch ($type) {
        //CSV=='1' XML=='2'
        case '1':
            $retVal = mosBooklibraryImportExport::importBooksCSV($file, $catid);
            HTML_booklibrary::showImportResult($retVal, $option);
            break;
        default:
            $retVal = mosBooklibraryImportExport::importBooksXML($_FILES['import_file']['tmp_name'], $catid);
            HTML_booklibrary::showImportResult($retVal, $option);
            break;
    }
}