Delete file from my host (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


wizard_oz -> Delete file from my host (9/7/2006 12:24:37)

Hi, I would like to delete a file from my host.
The code:
			set objFSO=server.CreateObject("Scripting.FileSystemObject")
			objFSO.DeleteFile "C:\Inetpub\wwwroot\magenli\Pictures\SinglePage\" & rs("CategoryPic") 

is working fine but I would like to delete the file from relative directory and not from an absolute. the problem is, if i am using :
objFSO.DeleteFile "../Pictures/SinglePage/" & rs("CategoryPic")
it doesn't work, Can someone help me?

Thanks, Elen




rdouglass -> RE: Delete file from my host (9/7/2006 14:05:56)

IIRC the FSO stuff always works with an absolute path and not a relative path. Having said that, we can usually get the absolute path by using Server.Mappath function. Maybe like this:

objFSO.DeleteFile Server.Mappath("../Pictures/SinglePage/" & rs("CategoryPic"))

Not sure of all your other stuff but I use Server.Mappath with FSO's all the time so I'm sure they work with 'em. Hope it helps.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875