NetTalk Central

Author Topic: Change the upload folder path run time  (Read 3767 times)

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Change the upload folder path run time
« on: June 08, 2009, 02:49:01 AM »
Hallo,


How can I change at run time the upload folder path ?

When the web server start I know but at run time ?


Thank you,
Robert

Alberto

  • Hero Member
  • *****
  • Posts: 1869
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Change the upload folder path run time
« Reply #1 on: June 08, 2009, 07:02:10 AM »
Hi Robert,

WebHandler proc
RenameFile method
Before parent call

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

Cheers
Alberto
-----------
Regards
Alberto

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: Change the upload folder path run time
« Reply #2 on: June 09, 2009, 05:14:55 AM »
Hallo Alberto,


Thank you for reply.

Can I put there a condition  ? If user send .zip files then I change the path to \Zip folder if they send .jpg I change the path to \JPG folder.

I use web client to upload some files to server.

Do you know how to do this ?

Or can I set a flag to client and then to check the flag on the server when the file arrive ?


Thank you for any suggestion,

Regards,
Robert


Alberto

  • Hero Member
  • *****
  • Posts: 1869
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Change the upload folder path run time
« Reply #3 on: June 09, 2009, 07:08:02 AM »
Yes, you can.
The filename is on p_filename.
You can look at the file extension anthen choose the folder.
You can even change the filenemae if you need.
For example you can use the following code:

  ext# = instring('.',p_filename,1,1)
  ext" = choose(ext#>0,sub(p_filename,ext#,4),'')
  case ext"
  of 'jpg'
...
...
...

Hope this helps
Alberto
-----------
Regards
Alberto

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: Change the upload folder path run time - Works perfect !
« Reply #4 on: June 09, 2009, 08:53:02 AM »
Hallo Alberto,


What a beautiful day today !

Thank you very much for this code. This example should be in manual and shipping example of NT :-)

on the case statement I need to  change 'jpg'  with  '.jpg'

case ext"
 of '.jpg'  (instead of 'jpg')


Thank you and have a ice day!


regards,
Robert