Location: PHPKode > scripts > PHP - File Upload > php-file-upload/upload_go.php
<?php
function do_upload($filename,$newname) {
  $file = basename($filename);
  $tmp_upload_path = "c:\\apache\\htdocs\\tmp\\";
  $new_file_name = "c:\\apache\\upload\\".$newname;
  if (!copy($tmp_upload_path.$file, $new_file_name)) echo "failed to copy file<br>\n";
  return;
}
?>

<HTML>

<HEAD>
<TITLE>PHP - file upload</TITLE>
<style type="text/css">
<!--
body   { font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
-->
</style>
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<?php

do_upload($userfile,$newname);
?>
<TABLE>
   <TR>
      <TD><b>upload report</b></TD><TD></TD>
   </TR>
   <TR>
      <TD>upload tmp file:</TD><TD><?php echo $userfile; ?></TD>
   </TR>
   <TR>
      <TD>file name:</TD><TD><?php echo $userfile_name; ?></TD>
   </TR>
  <TR>
      <TD>target file name:</TD><TD><?php echo $newname; ?></TD>
   </TR>
  <TR>
      <TD>target directory:</TD><TD>c:\apache\htdocs\tmp\</TD>
   </TR>
   <TR>
      <TD>file size:</TD><TD><?php echo $userfile_size; ?></TD>
   </TR>
   <TR>
      <TD>file type:</TD><TD><?php echo $userfile_type; ?></TD>
   </TR>
</TABLE>

</BODY>
</HTML>
Return current item: PHP - File Upload