NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Robert Iliuta on June 08, 2009, 02:49:01 AM

Title: Change the upload folder path run time
Post by: Robert Iliuta 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
Title: Re: Change the upload folder path run time
Post by: Alberto 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
Title: Re: Change the upload folder path run time
Post by: Robert Iliuta 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

Title: Re: Change the upload folder path run time
Post by: Alberto 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
Title: Re: Change the upload folder path run time - Works perfect !
Post by: Robert Iliuta 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