NetTalk Central

Author Topic: File upload: Ever lasting question  (Read 1480 times)

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
File upload: Ever lasting question
« on: June 08, 2022, 11:17:13 AM »
Hi,

Is there someone who knows all the ins and outs of the File Upload?
  • How, where and at which moment to change the upload-to location?
  • How, where and at which moment to do the rename of the uploaded file?
  • How, where and at which moment to find out if the upload is complete?
Cheers,
Ren?
Rene Simons
NT14.14

rjolda

  • Sr. Member
  • ****
  • Posts: 263
    • View Profile
    • Email
Re: File upload: Ever lasting question
« Reply #1 on: June 08, 2022, 03:14:37 PM »
Hi Renee,
File import and renaming happens in WebHandler.  According to an old app ( and my recall of conversations with Bruce...)

Enbed p_web  RenameFilePROCEDURE*(......)
Priority 5001 = AFTER Parent Call.
Here is my code:  ( a little messy with messages )
MESSAGE('pname ' & p_name)
if p_name = 'upfilename'  ! uploading schedule file
    locpath = p_web.GSV('tProvRptDir')  ! this is the provider file
 !   message('report dir ' & locpath)
    locpath = clip(locpath) & '\INFILE\'  ! this adds teh Infile path
  !  message('upload path: ' & locpath)
    RETURNVALUE = Parent.RenameFile(p_name,p_filename,locpath)
    RETURN  RETURNVALUE
END
FWIW,
Ron Jolda

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: File upload: Ever lasting question
« Reply #2 on: June 08, 2022, 11:46:23 PM »
Hi Ron,

Thanks. That wil make 2 out of 3 a lot easier.

Ren?

Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11155
    • View Profile
Re: File upload: Ever lasting question
« Reply #3 on: June 10, 2022, 04:11:18 AM »
RenameFile does not save the file. the form does that (in the SaveFile:: routine).
It is useful for renaming incoming file parameters though, at an "early point" when the name is coming in from the browser.

The SaveFile:: routine in your form calls the SaveFile method. That's usually where I modify the saving file name, and saving path if I want to.

>> How, where and at which moment to find out if the upload is complete?

by the time WebHandler sees it, it has already completely arrived.

Cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: File upload: Ever lasting question
« Reply #4 on: June 10, 2022, 03:15:11 PM »
Thanks Bruce
Rene Simons
NT14.14