I have an ASP Runner 9.1 project which includes a file upload field. I want to customize this so that the uploaded filename is prepended with the username and upload date. File types will vary. I have tried using the script from the manual but it doesn't appear to work.
Here is what I am trying in a "Before Record Added" event -
if bValue(values("UploadLink")) then
set fileArray = CreateDictionary()
set fileArray = my_json_decode(values("UploadLink"))
Set objFSO = CreateObject("Scripting.FileSystemObject")
' rename files
for i = 0 to aspcount(fileArray)-1
fileName = fileArray(i)("name")
newFileName = "../documents/" & session("username") & "" & formatDate(values("UploadDate"),"ddmmyyyy") & "_" & values("UploadLink")
sPath = left(getabspath(fileName),len(getabspath(fileName))-len(fileName))
objFSO.MoveFile getabspath(fileName) , sPath & newFileName
fileArray(i)("name") = newFileName
next
end if
' update values of the field that stores file names
values("UploadLink") = my_json_encode(fileArray)
When I try the script, I don't get an error response but no file name is entered into the field and the file is not uploaded.
Any help would be appreciated.