Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete a file with ASP

Status
Not open for further replies.

Robertus

Programmer
Feb 16, 2001
81
RO
Hi, there!

I have a database with a table that contains some .jpg files paths; the problem is that I want those paths to be RELATIVE to my site's directory (c:/inetpub/ The site is on a server; when the client clicked a "Delete picture" link I want an ASP that knows how to delete the pictures; the problem with the FileSystemObject is that its DeleteFiloe function needs an absolute path, but I want some kind of function that could delete the files given the RELATIVE paths;

Could you help me?
 
there is a similar problem I have come accross when showing where a database lays on the hard drive...I want a web site to be already functional when transfered to another server, without changing anything. But the db needs a physical path. The way I got around it is to put the db relative to the files I have, and then entering the server.mappath function in the dbq. I'm sure you could probably do the same for the pictures.

Example:

connString="DBQ=" & Server.MapPath("/db/myDataBase.mdb") & ";"


Now, if the picture was in your root directories "images" folder, named "image1.jpg", then you could probably use,

server.mappath("/images/image1.jpg")...

That will auto insert the current file sctructure, no matter if it's "C:\inetpub\ and then images\image1.jpg" or if it's "f:\inetpub\mywebsite\

Hope this helps!
-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top