php文件复制、重命名、删除操作

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hai7425/article/details/52868757

php文件的操作,复制、重命名(包含文件的复制功能)、文件的删除操作,

目的是为了实现通达OA将服务器某个目录里的文件自动上传到OA的某个模块下。

<?
echo mt_rand();
$file1="E:/MYOA/账户信息.docx";
$PATH="E:/MYOA/attach/workflow/1610/".mt_rand()."."."账户信息.docx";
//copy($file1,$PATH);
 echo @rename($file1,$PATH)?'成功':'失败';//2677@1505_1668115426
  //unlink($del_name)?'成功':'失败';

/*
if(!file_exists($SOURCE_FILE))
      return FALSE;

   if($MODULE=="")
      $MODULE=attach_sub_dir();
   if($YM=="")
      $YM=date('ym');

   $PATH=$ATTACH_PATH_ACTIVE.$MODULE;
   if(!file_exists($PATH) || !is_dir($PATH))
       mkdir($PATH, 0700);
   $PATH=$PATH."/".$YM;
   if(!file_exists($PATH) || !is_dir($PATH))
       mkdir($PATH, 0700);

   $ATTACH_FILE = MYOA_ATTACH_NAME_FORMAT ? (md5($ATTACH_NAME).".td") : $ATTACH_NAME;
   
   $ATTACH_ID = mt_rand();
   $FILENAME=$PATH."/".$ATTACH_ID.".".$ATTACH_FILE;

   if(file_exists($FILENAME))
   {
      $ATTACH_ID = mt_rand();
      $FILENAME=$PATH."/".$ATTACH_ID.".".$ATTACH_FILE;
   }
   
   $query = "insert into ATTACHMENT (POSITION, MODULE, YM, ATTACH_ID, ATTACH_FILE, ATTACH_NAME, ATTACH_SIGN) values ('$ATTACH_POS_ACTIVE', '".attach_module_id($MODULE)."', '$YM', '$ATTACH_ID', '$ATTACH_FILE', '$ATTACH_NAME', '$ATTACH_SIGN');";
   exequery(TD::conn(), $query);
   $AID = mysql_insert_id();
   */
?>


没有更多推荐了,返回首页