AnsweredAssumed Answered

Check if content file exist

Question asked by mau on Jan 29, 2009
Latest reply on Jan 30, 2009 by mau
I want to create a new file named 'my_new_file.html' in guest_home. It works if file not existed but it does not work if file existed.

      $nodes = $session->query($spacesStore, "PATH:\"app:company_home/app:guest_home\"");
      $contentNode = $nodes[0];

//???? How to verify if file exist????
      $newNode = $contentNode->createChild('cm_content', 'cm_contains', 'my_new_file.html');
      $contentData = new ContentData($newNode, 'cm:content');      
      $contentData->mimetype = 'text/html';
      $newNode->cm_name = $fileName;
      $newNode->cm_description = 'Page Description';
      $contentData->encoding = 'UTF-8';
      $contentData->content = '<html><head><tile>My test</title></head><body>Content of Test Page</body></html>';
      $newNode->cm_content = $contentData;

Please tell me how to verify if content file is already existed in the folder.