NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: ianburgess on June 17, 2012, 01:53:28 AM
-
I have put a File Upload control on a web form and all works fine - it uploads the file to the \uploads folder.
I need to upload the file to a different folder but cannot see what code to embed and where to embed it. I have come across p_web.RenameFile but not sure exactly how to use it?
My Filename field is DISH:Filename and I wish to upload to the \MemberFiles folder under the main \web folder - can someone suggest the correct code and where to embed?
Many thanks
Ian
-
Hi ianburgess!
In Example FileUpload(26) Bruce added some comment in NetWebHandler --> RenameFile method
you can put code like this self.site.UploadsPath = clip(self.site.WebFolderPath) & '\uploads\' &YourFolder before ParentCall
-
you can put code like this self.site.UploadsPath = clip(self.site.WebFolderPath) & '\uploads\' &YourFolder before ParentCall
Many thanks for the advice. My only remaining issue is where exactly to embed the code. Where in the netwebform procedure should this be embedded? I tried enbedding in the server side code embed of the upload button but this did not work, nor did embedding in procedure setup.
Thanks
Ian
-
Ok, I just realised that I must embed in the Webhandler procedure and not the form procedure, so embedded the following in Webhandler, renamefile (before Parent):
p_web.site.UploadsPath = clip(p_web.site.WebFolderPath) & p_web.GSV('UploadsSubfolder')
....and in the setup of the form procedure I set the session variable for the uploads folder:
eg.
p_web.SSV('UploadsSubfolder','\uploads\DiscussionFiles')
This way I can have different folders for each form if I want.
-
Also you can use the parameter p_path instead of UploadPath.
In form i use ValideteInsert for create folder (path store as session var) and ValidateDelete for delete file from server