Quote:
Originally Posted by jenkinsloveschicken
aashishn86,
So is your question how do you go about making an href to point to the file? Or are you trying to save the file name with the www address of the file?
I would suggest that if you are getting the file path and it is correct, then in your output page, you could perform a split on the file path on ":" and then append your www address prefix.
For example:
-
'''Using static sFile value for demonstration purposes
-
sFile = "contents.doc"
-
-
'''Get server file path
-
str_fullPath = Server.MapPath(".") & "\upload\" & sFile
-
-
'''Set the www prefix
-
str_httpPath = "http://3.212/232"
-
-
'''Remove localhost routing portion of the file path returned from Server.MapPath
-
'''First line creates a two value array, the local host portion is the 0 index and we
-
'''don't want that, so we use the 1 index of the str_httpPathProc array created by
-
'''the Split function
-
str_httpPathProc = split(str_fullPath,":")
-
-
'''Correct slash direction for www routing
-
str_httpPathProc1 = Replace(str_httpPathProc(1),"\","/")
-
-
'''Concatenate the www prefix the with processed file path
-
str_httpPath = str_httpPath & str_httpPathProc1
-
-
'''Write out our new file path. You can use this path as the href value to create
-
'''links to files on the server
-
Response.write str_httpPath
-
-
Hope that's what you were after. There are more complex methods, but this should get your started.
Best Regards,
Jenkins
that seems to solve my problem
but what if the server on which the site is hosted changes on a later date...
once the development is over. the server is likely to be changed...
i need a permanent solution...
would getting the server ip from Server.variables be okay ?