Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd> Receive uploaded files $ Conn = @ new COM ("ADODB. Connection "); $ Connstr = "DRIVER = {Microsoft Access Driver (*. mdb)}; DBQ =". realpath ("person. mdb "); $ Conn-> Open ($ connstr ); $ Uploaddir = 'uploads /'; If (! Is_dir ($ uploaddir )){ Mkdir ($ uploaddir ); } $ Filename = $ _ FILES ['filename'] ['name']; $ Filename = substr ($ _ FILES ['filename'] ["name"], 0, strpos ($ _ FILES ['filename'] ["name"], ". ")); Echo $ filename; Echo" "; $ Uploadfile = $ uploaddir. $ filename. substr ($ _ FILES ['filename'] ["name"], strpos ($ _ FILES ['filename'] ["name"], ". ")); // Directory name. file name. suffix name Echo $ uploadfile; Echo" "; $ Temploadfile = $ _ FILES ['filename'] ['tmp _ name']; Echo $ temploadfile; Echo" "; Move_uploaded_file ($ temploadfile, $ uploadfile); // move a file $ Path = $ _ SERVER ['script _ filename']; $ Filepath = $ _ SERVER ["PHP_SELF"]; $ Path = substr ($ path, 0, strpos ($ path, $ filepath )); Echo $ path; Echo" "; Echo $ filepath; $ Htmlpath = $ path. "/shiyan4/". $ uploadfile; Echo" "; Echo $ htmlpath; Word2html ($ htmlpath ); // $ Query = @ mysql_query ("Insert into $ username (fname, file) values ('$ filename',' $ uploadfile ')") or die ("error "); ?> // Http://tieba.baidu.com/f? Kz= 13975389 Function word2html ($ wfilepath) { $ Word = new COM ("Word. Application") or die ("cannot open MS Word "); $ Word-> visible = 1; $ Word-> Documents-> Open ($ wfilepath) or die ("This file cannot be opened "); $ Htmlpath = substr ($ wfilepath, 0,-4 ); $ Word-> ActiveDocument-> SaveAs ($ htmlpath, 8 ); $ Word-> quit (0 ); } Print ("Word to html! "); ?> |