NetTalk Central

Author Topic: Still fighting with the FileDownload Example  (Read 1153 times)

Richard I

  • Sr. Member
  • ****
  • Posts: 381
    • View Profile
    • Email
Still fighting with the FileDownload Example
« on: February 12, 2023, 08:28:31 PM »
Hi All,
I have deployed the FileDownload Example into my NT app by copying in from the example,
DocumentBrowse,DocumentForm and ServeDocument

Its working
However I now want to embed in, the ability to delete the file conditionally after serving
I presumed  that the code to delete should be in the ServeDocument WetWeb Page and I have this in the Footer Routine 4 End

  IF p_web.GSV('RemoveAfterServing') = 1
        remove(loc:filename)
        STOP('FileRemoved')
  END
This doesnt work.....
The Stop is not found presumably because the  p_web.GSV('RemoveAfterServing') is not found either
Recently I posted another request on the example, and it was  suggested to use the Server Side code embed but there doesnt seem to be that option on the ServeDocument NetWeb Page
So
Where should I conditionally code the deletion after serving please?
many thanks
Regards,
Richard
NT 12.54

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Still fighting with the FileDownload Example
« Reply #1 on: February 12, 2023, 11:15:32 PM »
Hi Richard

When when you (conditionally) let the file name start with '$$$' before serving,
it will be removed after it is served.

Ren?
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11177
    • View Profile
Re: Still fighting with the FileDownload Example
« Reply #2 on: February 12, 2023, 11:46:58 PM »
In S3reve Document is a Footer procedure.
this contains   
p_web._Sendfile(loc:fileName)

If you want to delete the file after sending it, then by all means add code in here after that call.

As Rene notes, if your filename starts with $$$ then the file is deleted for you by _sendfile.

Cheers
Bruce

Richard I

  • Sr. Member
  • ****
  • Posts: 381
    • View Profile
    • Email
Re: Still fighting with the FileDownload Example
« Reply #3 on: February 13, 2023, 12:42:25 AM »
Thanks Rene and Bruce
Rene, thanks, I am familiar with '$$$' and I will look at using this but I prefer to 'hand code' these sorts of things, so I have used remove(loc:filename) after the Send as described ny Bruce
Cheers
Richard
« Last Edit: February 13, 2023, 03:19:52 PM by Richard I »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11177
    • View Profile
Re: Still fighting with the FileDownload Example
« Reply #4 on: February 13, 2023, 07:11:11 PM »
>> I prefer to 'hand code' these sorts of things,

why?