8 Replies Latest reply: May 9, 2012 11:19 PM by 882670 RSS

    How to delete file from client machine

    882670
      Hi all,
      we are using the DataBase: oracle:10g,
      and forms/reports 10g(developer suite 10g-10.1.2.2).

      can anybody help me how to delete the file from client machine in specified location using webutil or any
      (i tried with webutil_host & client_host but it is working for application server only)
      thank you.
        • 1. Re: How to delete file from client machine
          Sarah
          hi


          i did not get you,if u want to delete a file u can use client_host.
          But you said its working in application server?
          plz what do u want to achieve exactly, and plz explain u r problem more.


          sarah
          • 2. Re: How to delete file from client machine
            882670
            Hi sarah,
            thanks for your response
            By the forms 10g using webutil_file_transfer.DB_To_Client_with_progress,user can able to download the file from db to client machine. after downloading the file i blocked the control webutil_host.blocking and file have to be open and released the control after closing the file.requirement is after user will close the file that file should be delete from the client machine.
            (for this i used client_host but it is searching for the file in application server)
            • 3. Re: How to delete file from client machine
              AmmadAhmed
              nagaraj wrote:
              (for this i used client_host but it is searching for the file in application server)
              Well, CLIENT_HOST doesn't search the file in AS. Make sure while you are removing the file from client side it is closed. I mean when you are trying to remove by code the file is being accessed by user or still exists in open tasks.

              -Ammad
              • 4. Re: How to delete file from client machine
                932794
                webutil_host.nonblocking ( 'cmd.exe /C DEL /F /Q c:\temp\test.pdf' ) ; -- To force delete in quite mode.

                Cheers
                • 5. Re: How to delete file from client machine
                  Sarah
                  hi

                  check this not tested.
                  PROCEDURE OPEN_FILE (V_ID_DOC IN VARCHAR2)
                  IS
                  
                  
                  
                  --------------------------------------------------------------------------------
                  -- Open a stored document --
                  
                  --------------------------------------------------------------------------------
                  LC$Cmd Varchar2(1280) ;
                  LC$Nom Varchar2(1000) ;
                  LC$Fic Varchar2(1280);
                  LC$Path Varchar2(1280);
                  LC$Sep Varchar2(1) ;
                  LN$But Pls_Integer ;
                  LB$Ok Boolean ;
                  -- Current Process ID --
                  ret WEBUTIL_HOST.PROCESS_ID ;
                  V_FICHERO VARCHAR2(500);
                  COMILLA VARCHAR2(4) := '''';
                  BOTON NUMBER;
                  MODO VARCHAR2(50);
                  URL VARCHAR2(500);
                  
                  Begin
                  
                  V_FICHERO := V_ID_DOC;
                  
                  
                  
                  LC$Sep := '\';--WEBUTIL_FILE.Get_File_Separator ; -- 10g
                  LC$Nom := V_FICHERO;--Substr( V_FICHERO, instr( V_FICHERO, LC$Sep, -1 ) + 1, 100 ) ;
                  --LC$Path := CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
                  LC$Path := 'C:';
                  LC$Fic := LC$Path || LC$Sep || LC$Nom ;
                  
                  
                  
                  If Not webutil_file_transfer.DB_To_Client
                  (
                  LC$Fic,
                  'TABLE_NAME',
                  'ITEM_NAME',
                  'WHERE'
                  ) Then
                  
                  Raise Form_trigger_Failure ;
                  
                  End if ;
                  
                  
                  
                  LC$Cmd := 'cmd /c start "" /MAX /WAIT "' || LC$Fic || '"' ;
                  Ret := WEBUTIL_HOST.blocking( LC$Cmd ) ;
                  LN$But := WEBUTIL_HOST.Get_return_Code( Ret ) ;
                  If LN$But 0 Then
                  Set_Alert_Property( 'ALER_STOP_1', TITLE, 'Host() command' ) ;
                  Set_Alert_Property( 'ALER_STOP_1', ALERT_MESSAGE_TEXT, 'Host() command error : ' || To_Char( LN$But ) ) ;
                  LN$But := Show_Alert( 'ALER_STOP_1' ) ;
                  LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
                  Raise Form_Trigger_Failure ;
                  End if ;
                  
                  
                  
                  If Not webutil_file_transfer.Client_To_DB
                  (
                  LC$Fic,
                  'TABLE_NAME',
                  'ITEM_NAME',
                  'WHERE'
                  ) Then 
                  NULL; 
                  Else
                  Commit ;
                  End if ;
                  LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
                  
                  
                  Exception
                  When Form_Trigger_Failure Then
                  Raise ;
                  End ;
                  sarah
                  • 6. Re: How to delete file from client machine
                    882670
                    thank you, now it is working ,
                    but opening the file, simply i am using this code
                    -------------------------------------------------------------------------------------------
                    ls_file_name varchar2(100):='C:\'||:b8.pdf_name||'_1.pdf';
                    ls_open:= 'cmd /c start "" /WAIT "' || Ls_file_name|| '"' ;
                    Ret := WEBUTIL_HOST.blocking(ls_open) ;
                    ls_result := WEBUTIL_HOST.Get_return_Code( Ret ) ;
                    -------------------------------------------------------------------------------------------
                    and it is working fine. but the problem is command prompt also opening along with file. i want to hide this command prompt. is it possible? can you please tell me.
                    • 7. Re: How to delete file from client machine
                      HamidHelal
                      nagaraj wrote:
                      thank you, now it is working ,
                      but opening the file, simply i am using this code
                      -------------------------------------------------------------------------------------------
                      ls_file_name varchar2(100):='C:\'||:b8.pdf_name||'_1.pdf';
                      ls_open:= 'cmd /c start "" /WAIT "' || Ls_file_name|| '"' ;
                      Ret := WEBUTIL_HOST.blocking(ls_open) ;
                      ls_result := WEBUTIL_HOST.Get_return_Code( Ret ) ;
                      -------------------------------------------------------------------------------------------
                      and it is working fine. but the problem is command prompt also opening along with file. i want to hide this command prompt. is it possible? can you please tell me.
                      Use NO_SCREEN in your code.
                      Like
                      ls_open:= 'cmd /c start "" /WAIT "' || Ls_file_name|| '"',NO_SCREEN ;
                      Hope this helps
                      • 8. Re: How to delete file from client machine
                        882670
                        thank you for your reply. but it is not working and giving the error at the time of file opening

                        Edited by: nagaraj on May 10, 2012 9:48 AM