NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: estadok on January 20, 2013, 09:54:06 AM

Title: Upload files to different folder
Post by: estadok on January 20, 2013, 09:54:06 AM
Hi!

What i'm doing wrong?
Code: [Select]
p_web.RenameFile PROCEDURE(STRING p_name,STRING p_filename,<String p_path>)

ReturnValue          ANY

! Start of "NetTalk Method Data Section"
! [Priority 5000]

! End of "NetTalk Method Data Section"

  CODE

 
  IF SELF.GSV('glo:agreement') = 0
     p_path = clip(self.site.WebFolderPath) & '\uploads\' &self.GSV('KLIF:Phone')
   ELSE
     p_path = clip(self.site.WebFolderPath) & '\uploads\agreements'
     SELF.SSV('glo:agreement',0)
  .
  ! Parent Call
  ReturnValue = PARENT.RenameFile(p_name,p_filename,p_path)
  ! [Priority 7500]

  SELF._Trace(ReturnValue)
  self.site.UploadsPath = clip(self.site.WebFolderPath) & '\uploads'

  RETURN ReturnValue

SELF._Trace(ReturnValue) this method returns the correct path to file, but file don't apears in folder... What is wrong in this code?
Title: Re: Upload files to different folder
Post by: Matthew on January 21, 2013, 05:12:49 AM
Don't change the parameter p_path, but propertie self.site.UploadsPath before Parent Call

So, try:

p_web.RenameFile PROCEDURE(STRING p_name,STRING p_filename,<String p_path>)

ReturnValue          ANY

! Start of "NetTalk Method Data Section"
! [Priority 5000]

! End of "NetTalk Method Data Section"

  CODE

 
  IF SELF.GSV('glo:agreement') = 0
     self.site.UploadsPath = clip(self.site.WebFolderPath) & '\uploads\' &self.GSV('KLIF:Phone')
   ELSE
     self.site.UploadsPath = clip(self.site.WebFolderPath) & '\uploads\agreements'
     SELF.SSV('glo:agreement',0)
  END
  ! Parent Call
  ReturnValue = PARENT.RenameFile(p_name,p_filename,p_path)
  ! [Priority 7500]

  SELF._Trace(ReturnValue)
  self.site.UploadsPath = clip(self.site.WebFolderPath) & '\uploads'

  RETURN ReturnValue

Regards,
Matthew
Title: Re: Upload files to different folder
Post by: Stu on January 21, 2013, 10:45:24 PM
Hi there,

I use a two-step (basic) method.

1. Wait for the file to be uploaded to the default upload folder, then

2. Move (rename) the file to whereever (in the web folder) I want.
Title: Re: Upload files to different folder
Post by: estadok on January 22, 2013, 10:01:28 AM
Thanks for advice! Both of these methods are work fine! :)