Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: how to delete file using asp?


Message #1 by "Julia" <gaika45@h...> on Thu, 25 Oct 2001 15:03:43
Dear All,



I'm currently working on deleting file using asp. below is my code

but it doesn't work. 



  Set File = CreateObject("Scripting.FileSystemObject")

  fileName = Request.form("FNAME")

  File.DeleteFile "C:\upload\" & fileName



Can someone tell me why? and how to fix it?. Thanks
Message #2 by Sam Clohesy <sam@e...> on Thu, 25 Oct 2001 15:23:32 +0100
Is filename the full name of the file?

Like myworddoc.doc??



Have you tried:



  Set File = CreateObject("Scripting.FileSystemObject")

  fileName = Request.form("FNAME")

if file.FileExists "C:\upload\" & fileName Then

reponse.write "there is a file here " & fileName

Else

response.write "Where is the file?"

End if





Maybe can't find the file?

Thanks

Sam



  File.DeleteFile "C:\upload\" & fileName





-----Original Message-----

From: Julia [mailto:gaika45@h...]

Sent: 25 October 2001 16:04

To: ASP Web HowTo

Subject: [asp_web_howto] how to delete file using asp?





Dear All,



I'm currently working on deleting file using asp. below is my code

but it doesn't work. 



  Set File = CreateObject("Scripting.FileSystemObject")

  fileName = Request.form("FNAME")

  File.DeleteFile "C:\upload\" & fileName



Can someone tell me why? and how to fix it?. Thanks




$subst('Email.Unsub')

Message #3 by "Pat Waddington" <paw@s...> on Thu, 25 Oct 2001 15:58:59 +0100
Check that 'File' isn't a reserved word. You can avoid this if you apply

coding conventions that put a "type" prefix  at the beginning of your

variable names e.g. change 'File' to 'objFile'



HTH Pat

----- Original Message -----

From: "Julia" <gaika45@h...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Thursday, October 25, 2001 3:03 PM

Subject: [asp_web_howto] how to delete file using asp?





> Dear All,

>

> I'm currently working on deleting file using asp. below is my code

> but it doesn't work.

>

>   Set File = CreateObject("Scripting.FileSystemObject")

>   fileName = Request.form("FNAME")

>   File.DeleteFile "C:\upload\" & fileName

>

> Can someone tell me why? and how to fix it?. Thanks
Message #4 by "Drew, Ron" <RDrew@B...> on Thu, 25 Oct 2001 16:22:00 -0400
Try:



Set mydir=Server.CreateObject("Scripting.FileSystemObject")

mydir.DeleteFile("C:\upload\" & fileName & """)



-----Original Message-----

From: Julia [mailto:gaika45@h...] 

Sent: Thursday, October 25, 2001 11:04 AM

To: ASP Web HowTo

Subject: [asp_web_howto] how to delete file using asp?





Dear All,



I'm currently working on deleting file using asp. below is my code but it

doesn't work. 



  Set File = CreateObject("Scripting.FileSystemObject")

  fileName = Request.form("FNAME")

  File.DeleteFile "C:\upload\" & fileName



Can someone tell me why? and how to fix it?. Thanks






  Return to Index