/**
  * @static
  */
 function operateAttach($source, $filename, $savedir, &$upload, $bhv)
 {
     $thumbInfo = array();
     if (PwUpload::isImage($upload['ext'])) {
         list($thumbInfo, $upload['ifthumb'], $upload['type']) = PwUpload::operateImage($source, $filename, $savedir, $upload, $bhv);
     } elseif ($upload['ext'] == 'txt') {
         if (preg_match('/(onload|submit|post|form)/i', readover($source))) {
             P_unlink($source);
             showUploadMsg('upload_content_error');
         }
         $upload['type'] = 'txt';
     }
     if ($bhv->ifftp) {
         if (!PwUpload::movetoftp($source, $savedir . $filename)) {
             return false;
         }
     } else {
         if (!PwUpload::movefile($source, PwUpload::savePath(0, $filename, $savedir))) {
             return false;
         }
     }
     if ($upload['ifthumb']) {
         PwUpload::operateThumb($thumbInfo, $bhv->allowWaterMark(), $bhv->ifftp, $upload['ext']);
     }
     return true;
 }