NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: rupertvz on September 12, 2017, 12:30:57 PM

Title: Set "Uploads Folder"
Post by: rupertvz on September 12, 2017, 12:30:57 PM
Hi Guys,

Is it possible to set the "Uploads Folder" after a user logs on?
Title: Re: Set "Uploads Folder"
Post by: Bruce on September 12, 2017, 09:27:44 PM
yes, the uploads folder is in
p_web.site.UploadsPath

Cheers
Bruce
Title: Re: Set "Uploads Folder"
Post by: rupertvz on September 12, 2017, 11:29:10 PM
Thank you Bruce,

I included the following line in WebHandler procedure:

p_web.site.UploadsPath = 'C:\MyWebsite\web\uploads\'&CLIP(P_Web.GetSessionValue('GLW:UserProfile'))

After the parent call for "SetSessionLevel"


It is correctly after the user logs on, but does not change / update the Uploads Folder.
Files are still being uploaded to the default path?
Title: Re: Set "Uploads Folder"
Post by: Bruce on September 13, 2017, 04:22:08 AM
>> After the parent call for "SetSessionLevel"

Seems like a strange place to put it Rupert - what's your thinking there?
I would likely have suggested ProcessLink, before parent call.

Cheers
Bruce
Title: Re: Set "Uploads Folder"
Post by: rupertvz on September 13, 2017, 04:44:15 AM
Thank you Bruce,

My thinking was to "update" the "uploads" folder, only After the user logged on.
I have to redirect the "Upload Path" to the "UserProfile" directory.

p_web.site.UploadsPath = 'C:\MyWebsite\web\uploads\'&CLIP(P_Web.GetSessionValue('GLW:UserProfile'))


I've added the code to ProcessLink (before parent call) but doesn't seem to update with the user-profile path?
Title: Re: Set "Uploads Folder"
Post by: Bruce on September 13, 2017, 11:43:51 PM
Hi Rupert,

p_web.site.UploadsPath

is a threaded variable, limited to a single request. It's not a session value.

>>  only After the user logged on.

so a change there _only_ applies to this thread.

>> I've added the code to ProcessLink (before parent call) but doesn't seem to update with the user-profile path?

presumably the session value of GLW:UserProfile is not set.

cheers
Bruce
Title: Re: Set "Uploads Folder"
Post by: rupertvz on September 27, 2017, 07:07:55 AM
Hi Bruce,

I've added a static path to "p_web.site.UploadsPath"
* Before parent call of "ProcessLink" in WebHandler.

This didn't change the default path for uploading documents, it still goes the original location.

Should I perhaps update somewhere else?
Title: Re: Set "Uploads Folder"
Post by: Bruce on September 27, 2017, 09:56:19 PM
perhaps.
Post an example app of what you have done and I'll see if you're doing it wrong.

cheers
Bruce
Title: Re: Set "Uploads Folder"
Post by: Alberto on September 28, 2017, 03:38:28 AM
Rupert, this is what I do in RenameFile before PC:

  self.site.UploadsPath = clip(self.site.WebFolderPath) & '\uploads\' & 'MyNewSubFolder'

and it works ok,

Regards