Build 8565_5671
My setup: Developer pc, and Alpha server pc (for web app)
Goal is to obtain particular files from the Alpha server and rename them.
For example, if the file name contains the string "PLACEHOLDER" then store it in a variable.
Then, FILE.rename is used to rename the file.
Using the code below, the developer pc (using Working Preview) can access files on the developer pc using fileFind.Get.
The web app, however, is seemingly unable to read files on the Alpha server pc.
----------------------------------------------------------------------------------------------------------------------------------------------
XBasic code is run utilizing Javascript Action - Ajax Callback. Here is the code:
FUNCTION xb_renameFiles as v (e as p)
'Find files that contain 'PLACEHOLDER' in file name
vFiles=Filefind.get("C:\A5webroot\session_folders\test\*PLACEHOLDER*",0,"PN")
'rename found files; 'PLACEHOLDER' replaced with 'TEST' (ie 'abcPLACEHOLDER.pdf' -> 'abcTEST.pdf')
for each vFileName in vFiles
vName=file.filename_parse(vFileName.value,"DPNE")
vPathName=alltrim(vFileName.value)
if (vName !="." .and. vName != "..") .and. (.not. file_is_open(vPathName)) then
'have a valid file so do something with file -- vPathName
scanner = stringscanner.create(vName)
scanner.replacestring("PLACEHOLDER","TEST")
vNewName = scanner.GetToOffset() + scanner.GetRemainder()
FILE.rename(vName,vNewName)
end if
next
END FUNCTION
--------------------------------------------------------------------------------------------------------------------------------------------------
Side note: Web app is able to rename server files 'FILE.rename()',
copy server files 'file_copy()', and email server files as attachments 'email_send_web()'.
So it would appear the files are visible from the web app.
Thanks in advance for your help.
My setup: Developer pc, and Alpha server pc (for web app)
Goal is to obtain particular files from the Alpha server and rename them.
For example, if the file name contains the string "PLACEHOLDER" then store it in a variable.
Then, FILE.rename is used to rename the file.
Using the code below, the developer pc (using Working Preview) can access files on the developer pc using fileFind.Get.
The web app, however, is seemingly unable to read files on the Alpha server pc.
----------------------------------------------------------------------------------------------------------------------------------------------
XBasic code is run utilizing Javascript Action - Ajax Callback. Here is the code:
FUNCTION xb_renameFiles as v (e as p)
'Find files that contain 'PLACEHOLDER' in file name
vFiles=Filefind.get("C:\A5webroot\session_folders\test\*PLACEHOLDER*",0,"PN")
'rename found files; 'PLACEHOLDER' replaced with 'TEST' (ie 'abcPLACEHOLDER.pdf' -> 'abcTEST.pdf')
for each vFileName in vFiles
vName=file.filename_parse(vFileName.value,"DPNE")
vPathName=alltrim(vFileName.value)
if (vName !="." .and. vName != "..") .and. (.not. file_is_open(vPathName)) then
'have a valid file so do something with file -- vPathName
scanner = stringscanner.create(vName)
scanner.replacestring("PLACEHOLDER","TEST")
vNewName = scanner.GetToOffset() + scanner.GetRemainder()
FILE.rename(vName,vNewName)
end if
next
END FUNCTION
--------------------------------------------------------------------------------------------------------------------------------------------------
Side note: Web app is able to rename server files 'FILE.rename()',
copy server files 'file_copy()', and email server files as attachments 'email_send_web()'.
So it would appear the files are visible from the web app.
Thanks in advance for your help.
Comment