NetTalk Central

Author Topic: set file upload folder unique for each session  (Read 3076 times)

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
set file upload folder unique for each session
« on: July 20, 2013, 03:00:14 PM »
NT7.15

I have a situation where I may have multiple users uploading files at the same time and some of the files may have the same name. Because of this, I cannot use a common folder for uploads.

I want to create a randomly named folder for each session so any files uploaded in a specific session will be uploaded into a uniquely name folder.

How can I set a unique upload folder for a session? When the files are uploaded by a user they will be processed in the SaveFile embed of the File Upload control in a form and they will be moved out of the upload folder to another location. When the session ends the randomly named upload folder will be removed.

Also, in the properties of a File Upload control where does the file go if "Save incoming file to uploads folder" is not checked?

Thanks,

Chuck







peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: set file upload folder unique for each session
« Reply #1 on: July 21, 2013, 10:15:03 PM »
Hi Chuck,

I have a similar situation where the users can upload a file with their logo to be used on various reports. Obviously this must be done to individual folders.

So what I do is this (in WebHandler - RenameFile - BeforeParent):

 if p_name = 'LogofileName'
    loc:path = p_web.GSV('cur_userpath')
    ReturnValue = Parent.RenameFile(p_name,p_filename,loc:path)
    Return ReturnValue
 end

cur_userpath is being set when the user logs in and it's your responsibility that the folder actually exists. You can tweak the above to fit your needs.

Peter

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: set file upload folder unique for each session
« Reply #2 on: July 22, 2013, 04:19:09 AM »
Thanks Peter - what is this - p_web.GSV() ?

Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: set file upload folder unique for each session
« Reply #3 on: July 22, 2013, 04:23:54 AM »
Never mind, I found it.

p_web.GSV() appears to be an abbreviated version of p_web.GetSessionValue()

Chuck