0 Replies Latest reply on Mar 16, 2010 5:00 PM by ikoniqoz

    Guenter's Tutorials

    ikoniqoz Level 1

      Hi

      I am attempting to use one of Guenter's tutorials. The one which allows you to upload a file to the server and replace the existing file of the same name without performing the normal ADDT action of re-naming the file.

       

      I have included Guenter's code as per his tutorial on http://www.guenter-schenk.com/tutorials/tutorial.php?id=7 with some minor changes. However, it appears that the Custom Trigger never gets called. My Custom Trigger is:

       

      //start Trigger_Delete_Existing trigger
      function Trigger_Delete_Existing(&$tNG) {
      // user definable variables
      $folderpath = '../../availabilty_files';
      $filename = $tNG->getColumnValue("filename_avl");

       

      // application logic
      $fullpath = $folderpath.'/'.$filename;
      if (file_exists($fullpath)) {
      //    @chmod($folderpath,0777);
          @unlink($fullpath);
      //    @chmod($folderpath,0755);
          }
      }
      //end Trigger_Delete_Existing trigger

       

      And I have set the Trigger like so:

       

      // Register triggers
      $upd_availability_avl->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1");
      $upd_availability_avl->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
      $upd_availability_avl->registerTrigger("END", "Trigger_Default_Redirect", 99, "../adminTasks.php");
      $upd_availability_avl->registerTrigger("AFTER", "Trigger_Delete_Existing", 50);
      $upd_availability_avl->registerTrigger("AFTER", "Trigger_FileUpload", 97);

       

      Now when I upload the file which has the same file name as the existing file on the server, it renames the file leaving the original.

       

      The file I am wanting to upload is a .htm file and I have that setup correctly in the File Upload SB

       

      If anyone can spot the error in my code I would be forever greatful.

       

      Cheers.

       

      Message was edited by: WollombiWombat