Forum Moderators: open
i have the following code in my script that basically creates ID.txt files in the same directory that my script is in,
fname = server.mappath(ID & ".txt")
i wanted to create another directory within my script folder called data and get the script to map to that instead.
i assumed maybe it will be something like this:
fname = server.mappath/data(ID & ".txt")
but that doesnt seem to work.
any help would be appreciated.
thanx in advanced
fname = server.mappath("data/" & ID + ".txt")
notice that this one has a + instead of a & after the ID, is this an error or is there a particular reason for that?
In Classic ASP using VBScript I don't believe there is a difference. The better practice/recommended form in this case would be to use '&' since you're working with strings. The '+' side can cause confusion and possible errors down the road since it would add numeric data together rather than appending it to the end as you would have intended.
Example:
Response.Write(1 + "2") -- would return 3
Response.Write(1 & "2") -- would return 12