Forums
This topic is locked
delete file when modify a recordset
Posted 18 Sep 2001 17:31:03
1
has voted
18 Sep 2001 17:31:03 anouar stevens posted:
i have a form with uploading a file to server so when the user want to modify his recod and set a new file the old file must be delete from the server ,
any idea to di this??
think's a lot
Replies
Replied 19 Sep 2001 22:30:17
19 Sep 2001 22:30:17 anouar stevens replied:
after a long work and searching in in many site and i don't find any answer exactly but there this code that can help the personne to resolve this a small probleme <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
just find this tws line when you do all
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
and after you put this line:---->
var1 = Request.QueryString("Strfile"
if var1 <> "" then
Set File = CreateObject("Scripting.FileSystemObject"
ImagePath = Server.MapPath("..\Database\Picture\"
ImagePath = ImagePath & "\" & (Request.QueryString("Strfile")
File.DeleteFile(ImagePath)
end if
in the end you must send in a variable "Strfile" the name of the picture to delete in url
it's all
Good lucky
just find this tws line when you do all
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
and after you put this line:---->
var1 = Request.QueryString("Strfile"
if var1 <> "" then
Set File = CreateObject("Scripting.FileSystemObject"
ImagePath = Server.MapPath("..\Database\Picture\"
ImagePath = ImagePath & "\" & (Request.QueryString("Strfile")
File.DeleteFile(ImagePath)
end if
in the end you must send in a variable "Strfile" the name of the picture to delete in url
it's all
Good lucky