Home » Developer & Programmer » Forms » Deleting a uploaded file from server (Forms 10g)
Deleting a uploaded file from server [message #478632] Mon, 11 October 2010 06:15 Go to next message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Dear All,
We uploaded files to application server,using
webutil_file_transfer.client_to_as_with_progress
Now, we want to delete the file through forms, when user click a button.

we tried this,using HOST command.
DECLARE
   CURSOR c_path
   IS
      SELECT attachpath
        FROM PATHTAB
       WHERE apid = :parameter.apid;

   file_name   VARCHAR2 (500);
   v_path      VARCHAR2 (200);
   v_name      VARCHAR2 (1000);
   v_doc       VARCHAR2 (10);
   v_grn       VARCHAR2 (30);
BEGIN
   IF :STSHPADV3.filename IS NULL
   THEN
      IF common.raise_alert ('NOTE', 'File Not Uploaded..! ')
      THEN
         NULL;
      END IF;
   ELSE
      OPEN c_path;

      FETCH c_path INTO v_path;

      CLOSE c_path;

      v_name := v_path || '\' || :STSHPADV3.filename;

      IF common.raise_alert (
            'CAUTION',
            'Do you want to Delete ' || :STSHPADV3.filename || '   ...? ')
      THEN
         HOST ('DEL v_name', NO_PROMPT);

         IF common.raise_alert ('NOTE', 'File Deleted Successfully...! ')
         THEN
            NULL;
         END IF;
      END IF;
   END IF;
END;

But not working,
please suggest a solution.

Thanks and Regards
Deepak

[EDITED by LF: code reformatted; applied [code] tags to preserve formatting]

[Updated on: Mon, 11 October 2010 06:55] by Moderator

Report message to a moderator

Re: Deleting a uploaded file from server [message #478639 is a reply to message #478632] Mon, 11 October 2010 06:55 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What does "not working" mean? Any error? If so, which one? If not, what is it, then?
Re: Deleting a uploaded file from server [message #478642 is a reply to message #478639] Mon, 11 October 2010 07:03 Go to previous messageGo to next message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Dear Littlefoot,
It is not showing any Error message, but the file is not deleting.

Thanks and Regards
Deepak
Re: Deleting a uploaded file from server [message #478645 is a reply to message #478642] Mon, 11 October 2010 07:18 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Remove NO_PROMPT from
HOST ('DEL v_name', NO_PROMPT);
Perhaps you'll see something useful.

Is V_NAME correctly created? Display it to the screen to make sure it is!


Not related to your problem, but: you don't need a cursor here. Simply
SELECT attachpath
  INTO v_path
  FROM PATHTAB
  WHERE apid = :parameter.apid;
instead of
OPEN c_path;
FETCH c_path INTO v_path;
CLOSE c_path;
Re: Deleting a uploaded file from server [message #478648 is a reply to message #478645] Mon, 11 October 2010 07:43 Go to previous messageGo to next message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Dear Littlefoot,
Thanks for your advice,
I put message and the file name Showing properly
C:/temprep/docs/test.txt;

Thanks and Regards
Deepak
Re: Deleting a uploaded file from server [message #478651 is a reply to message #478648] Mon, 11 October 2010 07:53 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What happened when you removed NO_PROMPT?
Re: Deleting a uploaded file from server [message #478652 is a reply to message #478651] Mon, 11 October 2010 07:58 Go to previous messageGo to next message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Dear Littlefoot,

No change, same result. Can you please suggest a different way
Thanks and Regards
Deepak

[Updated on: Mon, 11 October 2010 08:38]

Report message to a moderator

Re: Deleting a uploaded file from server [message #478670 is a reply to message #478652] Mon, 11 October 2010 15:30 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Hm. If nothing happens, maybe the "deleting" part is never executed?

What happens if you omit everything and leave only
HOST ('DEL C:/temprep/docs/test.txt');
in WHEN-BUTTON-PRESSED trigger? It *should* work. Does it?

If so, add piece by piece and test every step you make, until the solution is complete.
Re: Deleting a uploaded file from server [message #478688 is a reply to message #478670] Tue, 12 October 2010 01:10 Go to previous messageGo to next message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Dear Littlefoot,
Sorry for the late reply. Problem solved, it was my mistake. I put
HOST('DEL v_name',NO_PROMPT);
, instead of
HOST('DEL '||v_name,NO_PROMPT);
. Sorry for wasting your time too. Keep in touch

Thanks a lot for your help.
Regards
Deepak
Re: Deleting a uploaded file from server [message #478697 is a reply to message #478688] Tue, 12 October 2010 01:36 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Heh, so obvious! How didn't we see it yesterday?!? /forum/fa/1606/0/
Re: Deleting a uploaded file from server [message #478698 is a reply to message #478697] Tue, 12 October 2010 01:38 Go to previous message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Ya, Sometimes it happens for all..
Previous Topic: ORACLE ERROR Unable to read list of values
Next Topic: loop not working properly
Goto Forum:
  


Current Time: Thu Sep 19 18:48:55 CDT 2024