Пример #1
0
 /**
  * Try copy file from $source to $this->Destination
  *
  * @param string $source
  * @return bool
  */
 public function CopyFile($source)
 {
     // Try to copy
     if (!@copy($source, $this->Destination)) {
         $this->RaiseWarning(_("Failed to copy a file. Please check filesystem access permissions."), false);
         return false;
     } else {
         // Generate real file info
         $this->File = array("name" => basename($source), "type" => IOTool::GetFileMimeType($this->Destination), "size" => filesize($this->Destination));
         // Validate real file info
         if ($this->Validate()) {
             return true;
         } else {
             // If Validate returned false remove file and return false
             @unlink($this->Destination);
             return false;
         }
     }
 }