NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Richard I on February 12, 2023, 08:28:31 PM

Title: Still fighting with the FileDownload Example
Post by: Richard I 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
Title: Re: Still fighting with the FileDownload Example
Post by: Rene Simons 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?
Title: Re: Still fighting with the FileDownload Example
Post by: Bruce 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
Title: Re: Still fighting with the FileDownload Example
Post by: Richard I 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
Title: Re: Still fighting with the FileDownload Example
Post by: Bruce on February 13, 2023, 07:11:11 PM
>> I prefer to 'hand code' these sorts of things,

why?