NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on January 28, 2009, 08:29:04 AM
-
Hi,
When using Upload, all files goes to the upload folder.
How can I change that destination folder at run time ?
Thanks
Alberto
-
For security reasons only the server can specify the folder, not the client.
On the server side it's in a property
p_web.site.UploadsPath
Cheers
Bruce
-
OK, but I cant make it work.
Where should I chage it?
I´m trying with
p_web.site.UploadsPath = 'web\uploads\'&p_web.GetSessionValue('USU:ID')&'\'&p_web.GetSessionValue('DAT:ID')
In which embed should I put it?
Thanks
Alberto
-
WebHandler procedure
ProcessLink method
Before parent call.
Cheers
Bruce
-
Does not work...
My code:
if p_web.GetSessionValue('DAT:ID')>0
Goc:MekeDir = longpath()&'\web\uploads\pac'&p_web.GetSessionValue('DAT:ID')
SolaceResult# = SolaceCreateDirectoryA(Goc:MekeDir,SECURITY_ATTRIBUTES)
p_web.site.UploadsPath = 'web\uploads\pac'&p_web.GetSessionValue('DAT:ID')
end
The dir is created but the file is uploaded to the web\upload folder
What am I doing wrong?
-
Have you tried:
p_web.site.UploadsPath = longpath()&'\web\uploads\pac'&p_web.GetSessionValue('DAT:ID')
or even just (creating this folder yourself)
p_web.site.UploadsPath = 'uploads\test\'
to narrow down the possible problems
Kevin
-
Have a look at what is in the property before you replace it.
You'll see it's "fully qualified", not relative to the current folder.
It needs to be "fully qualified" - and hence Kevin's suggestion is most likely the right one.
p_web.site.UploadsPath = longpath()&'\web\uploads\pac'&p_web.GetSessionValue('DAT:ID')
Cheers
Bruce
-
The property before the replace is:
p_web.site.UploadsPath = 'web\uploads'
I make the dir with a complete path like:
Goc:MekeDir = longpath()&'\web\uploads\pac'&p_web.GetSessionValue('DAT:ID')
Then I add the new subdir to the uploadsPath
p_web.site.UploadsPath = 'web\uploads\pac'&p_web.GetSessionValue('DAT:ID')
And the file still uploads to 'web\uploads'
Will try with the fullpath...
-
With the fullpath it still uploads to web\upload.
There must be somthing wrong with the property o the embed.
Any Idea??
-
put some debugging in so you can see what the property is set to before you change it, and after you change it.
Cheers
Bruce
-
Thats what I did!
The property before the replace is:
p_web.site.UploadsPath = 'web\uploads'
Then I create and add the new subdir to the uploadsPath, now the property value is:
p_web.site.UploadsPath = 'web\uploads\pac'
And the file still uploads to 'web\uploads'
-
I think I found the problem...
The p_web.ProcessLink is called many times during allmost every page you see in the browser.
Every time it is called the p_web.site.UploadsPath is : web\uploads
I change it to web\uploads\pac
verified, after the parent call p_web.site.UploadsPath is : web\uploads\pac
but in the next call to the ProcessLink it is web\uploads again!
I think another method is changing it!
More, when you press "save" to upload the file, the file is uploaded BEFORE the ProcessLink is called.
Please help!
Alberto
If I did not be so clear before...
p_web.ProcessLink PROCEDURE(<string p_action>)
CODE
!debuging... p_web.site.UploadsPath is : web\uploads
p_web.site.UploadsPath = 'web\uploads\pac'
PARENT.ProcessLink(p_action)
!debuging... p_web.site.UploadsPath is : web\uploads\pac
But the file is still upload to web\uploads!
PS: what is p_action?
Thanks
Alberto
-
you can read about p_action in the netweb.clw file.
Look for the processLink method, and see what it does with the parameter.
In the same way you can also search netweb.clw to see where uploads folder is being set, and where it is being used. In that way oyu can determine the best embed point to use to set it to what you want just before you use it.
Cheers
Bruce
-
Alberto,
Why not take a different approach, simply upload the file where it goes and then copy it where you want it and then delete the file.
The embed point is Routines -> PostInsert -> Start and the code something like this:
copy(p_web.gsv('PATH') & '\web\'&clip(fil:name),'\\'&clip(GLOD:Server)&'\eds\c\'&left(format(Image:ImageNo,@n_8))&clip(ExtType))
remove(p_web.gsv('PATH') & '\web\'&clip(fil:name))
OR
copy(p_web.gsv('PATH') & '\web\'&clip(fil:name),'WHEREVER YOU WANT TO COPY THE FILE TO')
remove(p_web.gsv('PATH') & '\web\'&clip(fil:name))
fil:name for some reason is always '\uploads\filename.ext'. Hope this helps.
Cheers
Charl
-
Good Idea
Same Q of the other post...
What happen when two users uploads the same file (same filenema)?
Regards
Alberto
-
Hallo Alberto,
I tried 3 weeks ago to do the same thing ...... without success. All files uploads to upload folder. I try to do in different ways but doesn't work.
I think it's something from NT .
Next week I will go again to check this issue because I have user that will upload the same file .... and I need to upload files to different folders.
To copy is not the best method. Why should I write a routine to monitored the upload folder ? Simple will be to upload to different folder.
If someone has an example , please share that example.
Thank you,
Regards,
Robert Iliuta
-
Bruce,
I´ve tried everything...
I´ve looked into the inc, clw and did not found a way to set the p_web.site.UploadsPath
without it beeing reverted magically to the default value!
Please, take a look! its important for some of us...
Thanks
Alberto
-
I have put some (commented out) code in the Example 26 for the next build, which places the file into web\alternate instead of \web\uploads.
Cheers
Bruce